FULLY COMPLETE TERMINAL COLORS

This commit is contained in:
Michael 2017-03-09 18:15:29 -05:00
parent b4a5c854c8
commit a9b08eb216
5 changed files with 39 additions and 11 deletions

View file

@ -446,6 +446,30 @@ namespace ShiftOS.WinForms.Applications
flbody.Controls.Add(color);
color.Show();
}
else if(c.Field.FieldType.IsEnum == true)
{
var cBox = new ComboBox();
cBox.Width = 150;
ControlManager.SetupControl(cBox);
foreach(var itm in Enum.GetNames(c.Field.FieldType))
{
cBox.Items.Add(itm);
}
cBox.Text = c.Field.GetValue(LoadedSkin).ToString();
cBox.SelectedIndexChanged += (o, a) =>
{
c.Field.SetValue(LoadedSkin, Enum.Parse(c.Field.FieldType, cBox.Text));
};
labelHeight = cBox.Height;
flbody.Controls.Add(cBox);
cBox.Show();
flbody.SetFlowBreak(cBox, true);
}
else if(c.Field.FieldType == typeof(int))
{
if (c.Field.HasShifterEnumMask())

View file

@ -34,6 +34,7 @@ using System.Windows.Forms;
using ShiftOS.Engine;
using Newtonsoft.Json;
using static ShiftOS.Engine.SkinEngine;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications {
[Launcher("Shiftnet", false, null, "Networking")]
@ -62,6 +63,8 @@ namespace ShiftOS.WinForms.Applications {
}
public string ConstructHtml(string markdown) {
var TerminalForeColor = ControlManager.ConvertColor(SkinEngine.LoadedSkin.TerminalForeColorCC);
var TerminalBackColor = ControlManager.ConvertColor(SkinEngine.LoadedSkin.TerminalBackColorCC);
string html = $@"<html>
<head>
<style>
@ -90,8 +93,8 @@ namespace ShiftOS.WinForms.Applications {
pre, code {{
font-family: ""{LoadedSkin.TerminalFont.Name}"";
font-size: {LoadedSkin.TerminalFont.SizeInPoints}pt;
color: rgb({LoadedSkin.TerminalForeColor.R}, {LoadedSkin.TerminalForeColor.G}, {LoadedSkin.TerminalForeColor.B});
background-color: rgb({LoadedSkin.TerminalBackColor.R}, {LoadedSkin.TerminalBackColor.G}, {LoadedSkin.TerminalBackColor.B});
color: rgb({TerminalForeColor.R}, {TerminalForeColor.G}, {TerminalForeColor.B});
background-color: rgb({TerminalBackColor.R}, {TerminalBackColor.G}, {TerminalBackColor.B});
}}
</style>
</head>

View file

@ -43,6 +43,7 @@ using System.Collections;
using static ShiftOS.Engine.SkinEngine;
using ShiftOS.Engine;
using ShiftOS.Objects;
using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
@ -350,8 +351,8 @@ namespace ShiftOS.WinForms.Applications
txt.Focus();
txt.Font = LoadedSkin.TerminalFont;
txt.ForeColor = LoadedSkin.TerminalForeColor;
txt.BackColor = LoadedSkin.TerminalBackColor;
txt.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
txt.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
}
@ -391,8 +392,7 @@ namespace ShiftOS.WinForms.Applications
rtbterm.Text = AppearanceManager.LastTerminalText;
rtbterm.Select(rtbterm.TextLength, 0);
}
Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
TerminalBackend.PrintPrompt();
}
@ -403,8 +403,8 @@ namespace ShiftOS.WinForms.Applications
try
{
rtbterm.Font = LoadedSkin.TerminalFont;
rtbterm.ForeColor = LoadedSkin.TerminalForeColor;
rtbterm.BackColor = LoadedSkin.TerminalBackColor;
rtbterm.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
rtbterm.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
}
catch
{

View file

@ -865,12 +865,12 @@ namespace ShiftOS.Engine {
[ShifterMeta("System")]
[ShifterCategory("General")]
[ShifterName("Terminal text color")]
public Color TerminalForeColor = DefaultForeground;
public ConsoleColor TerminalForeColorCC = ConsoleColor.White;
[ShifterMeta("System")]
[ShifterCategory("General")]
[ShifterName("Terminal background color")]
public Color TerminalBackColor = DesktopBG;
public ConsoleColor TerminalBackColorCC = ConsoleColor.Black;
[ShifterMeta("Desktop")]
[ShifterCategory("Desktop Panel")]

View file

@ -286,6 +286,7 @@ namespace ShiftOS.Engine
public static void PrintPrompt()
{
ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC;
ConsoleEx.Italic = false;
ConsoleEx.Underline = false;
@ -311,7 +312,7 @@ namespace ShiftOS.Engine
Console.Write("$");
ConsoleEx.Italic = false;
ConsoleEx.Bold = false;
ConsoleEx.ForegroundColor = ConsoleColor.White;
ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC;
Console.Write(" ");
}