Added default theme
This commit is contained in:
parent
959034df62
commit
8128baa107
3 changed files with 91 additions and 4 deletions
87
extra/DefaultTheme.oss
Normal file
87
extra/DefaultTheme.oss
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
% ================== DefaultTheme.oss ==================
|
||||||
|
|
||||||
|
|
||||||
|
% ---- Variables ----
|
||||||
|
const $accentColor = #DC143CFF
|
||||||
|
const $textColor = #111111FF
|
||||||
|
const $accentColorLight = #F16A85FF
|
||||||
|
const $accentColorDark = #6B0A1DFF
|
||||||
|
% -------------------
|
||||||
|
|
||||||
|
|
||||||
|
% ------ Root Widget ------
|
||||||
|
window.backgroundColor = rgba(160, 160, 160, 255)
|
||||||
|
% -------------------------
|
||||||
|
|
||||||
|
|
||||||
|
% ------ Panel ------
|
||||||
|
(panel) {
|
||||||
|
backgroundColor = #AAAAAAFF
|
||||||
|
titleColor = $accentColorDark
|
||||||
|
titlebarColor = #999999FF
|
||||||
|
titlebarBorderColor = #909090FF
|
||||||
|
borderColor = #909090FF
|
||||||
|
borderRadius = 10
|
||||||
|
borderWidth = 2
|
||||||
|
titlebarBorderWidth = 2
|
||||||
|
showBorder = true
|
||||||
|
showBackground = true
|
||||||
|
titlebarType = full
|
||||||
|
titlebarHeight = 18
|
||||||
|
titlebarFontSize = 18
|
||||||
|
titlebarTextAlign = text_left
|
||||||
|
padding = Rect(15, 15, 15, 15)
|
||||||
|
margin = Rect(0, 0, 0, 0)
|
||||||
|
}
|
||||||
|
% -------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
% ------ CheckBox ------
|
||||||
|
(checkbox) {
|
||||||
|
checkBorderColor = $accentColorDark
|
||||||
|
checkBoxColor = $accentColor
|
||||||
|
textColor = $textColor
|
||||||
|
backgroundColor = color_transparent
|
||||||
|
borderColor = color_transparent
|
||||||
|
fontSize = 20
|
||||||
|
borderRadius = 0
|
||||||
|
borderWidth = 0
|
||||||
|
checkBorderRadius = 6
|
||||||
|
checkBorderWidth = 2
|
||||||
|
showBackground = false
|
||||||
|
showBorder = false
|
||||||
|
padding = Rect(15, 15, 15, 15)
|
||||||
|
margin = Rect(0, 0, 0, 0)
|
||||||
|
}
|
||||||
|
(checkbox:hover) {
|
||||||
|
checkBorderColor = $accentColorLight
|
||||||
|
}
|
||||||
|
(checkbox:pressed) {
|
||||||
|
checkBoxColor = $accentColor
|
||||||
|
textColor = $accentColorDark
|
||||||
|
checkBorderColor = $accentColor
|
||||||
|
}
|
||||||
|
(checkbox:active) {
|
||||||
|
checkBoxColor = $accentColor
|
||||||
|
checkBorderColor = $accentColor
|
||||||
|
textColor = $accentColorDark
|
||||||
|
}
|
||||||
|
% ----------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
% ------ Label ------
|
||||||
|
(label) {
|
||||||
|
textColor = $textColor
|
||||||
|
backgroundColor = color_transparent
|
||||||
|
borderColor = color_transparent
|
||||||
|
fontSize = 20
|
||||||
|
borderRadius = 0
|
||||||
|
borderWidth = 0
|
||||||
|
showBackground = false
|
||||||
|
showBorder = false
|
||||||
|
padding = Rect(15, 15, 15, 15)
|
||||||
|
margin = Rect(0, 0, 0, 0)
|
||||||
|
}
|
||||||
|
% -------------------
|
||||||
|
|
@ -48,6 +48,7 @@ namespace ogfx
|
||||||
enableBackground(getThemeValue<bool>(theme, "panel.showBackground", true));
|
enableBackground(getThemeValue<bool>(theme, "panel.showBackground", true));
|
||||||
setBorderColor(getThemeValue<Color>(theme, "panel.borderColor", Colors::Black));
|
setBorderColor(getThemeValue<Color>(theme, "panel.borderColor", Colors::Black));
|
||||||
setPadding(getThemeValue<Rectangle>(theme, "panel.padding", { 15, 15, 15, 15 }));
|
setPadding(getThemeValue<Rectangle>(theme, "panel.padding", { 15, 15, 15, 15 }));
|
||||||
|
setMargin(getThemeValue<Rectangle>(theme, "panel.margin", { 0, 0, 0, 0 }));
|
||||||
m_basePadding = getPadding();
|
m_basePadding = getPadding();
|
||||||
m_titleColor = getThemeValue<Color>(theme, "panel.titleColor", Colors::Black);
|
m_titleColor = getThemeValue<Color>(theme, "panel.titleColor", Colors::Black);
|
||||||
m_titlebarColor = getThemeValue<Color>(theme, "panel.titlebarColor", Colors::Transparent);
|
m_titlebarColor = getThemeValue<Color>(theme, "panel.titlebarColor", Colors::Transparent);
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class Window : public ogfx::gui::Window
|
||||||
|
|
||||||
m_label1.addThemeOverride("@:pressed.label.textColor", Colors::Crimson);
|
m_label1.addThemeOverride("@:pressed.label.textColor", Colors::Crimson);
|
||||||
|
|
||||||
m_theme.loadFromFile("./testTheme.oss", true, getDefaultStylesheetVariableList());
|
m_theme.loadFromFile("./DefaultTheme.oss", true, getDefaultStylesheetVariableList());
|
||||||
|
|
||||||
m_label2.addThemeOverride("@:hover.label.showBackground", true);
|
m_label2.addThemeOverride("@:hover.label.showBackground", true);
|
||||||
m_label2.addThemeOverride("@:hover.label.backgroundColor", Colors::DarkGreen);
|
m_label2.addThemeOverride("@:hover.label.backgroundColor", Colors::DarkGreen);
|
||||||
|
|
@ -155,13 +155,12 @@ class Window : public ogfx::gui::Window
|
||||||
|
|
||||||
void onRedraw(ogfx::BasicRenderer2D& gfx) override
|
void onRedraw(ogfx::BasicRenderer2D& gfx) override
|
||||||
{
|
{
|
||||||
gfx.drawAnimation(m_anim, { 200, 200 });
|
// gfx.drawAnimation(m_anim, { 200, 200 });
|
||||||
gfx.outlinedTriangle({ 30, 30 }, { 100, 50 }, { 60, 90 }, { 255, 0, 0, 80 }, Colors::DarkBlue, 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFixedUpdate(void) override
|
void onFixedUpdate(void) override
|
||||||
{
|
{
|
||||||
m_anim.update();
|
// m_anim.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue