From 4e37f4b23eb88b0bb7f8ba8787e3a50bb0e3aa8e Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Fri, 15 May 2020 17:02:18 +0200 Subject: [PATCH] Added secondary colors to palette. --- ui/examples/01_basic/basic.go | 4 ++-- ui/style.go | 35 +++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ui/examples/01_basic/basic.go b/ui/examples/01_basic/basic.go index 712376a..9cb90e8 100644 --- a/ui/examples/01_basic/basic.go +++ b/ui/examples/01_basic/basic.go @@ -4,8 +4,8 @@ import ( "image/color" "log" - _ "opslag.de/schobers/zntg/sdlui" // import the renderer for the UI - // _ "opslag.de/schobers/zntg/allg5ui" // import the renderer for the UI + // _ "opslag.de/schobers/zntg/sdlui" // import the renderer for the UI + _ "opslag.de/schobers/zntg/allg5ui" // import the renderer for the UI "opslag.de/schobers/geom" "opslag.de/schobers/zntg/ui" diff --git a/ui/style.go b/ui/style.go index 7147ebe..f8e3262 100644 --- a/ui/style.go +++ b/ui/style.go @@ -33,6 +33,14 @@ type Palette struct { PrimaryHighlight color.Color // PrimaryLight is a background version of the main contrast color. PrimaryLight color.Color + // Secondary is used as a the secondary contrast color. + Secondary color.Color + // SecondaryDark is a foreground version of the secondary contrast color. + SecondaryDark color.Color + // SecondaryHighlight is a light version of the secondary contrast color. + SecondaryHighlight color.Color + // SecondaryLight is a background version of the secondary contrast color. + SecondaryLight color.Color // ShadedBackground is a darker version of the background color. ShadedBackground color.Color // Text is the default text color. @@ -43,6 +51,8 @@ type Palette struct { TextNegative color.Color // TextOnPrimary is the text color when used with the main contrast color as background. TextOnPrimary color.Color + // TextOnSecondary is the text color when used with the secondary contrast color as background. + TextOnSecondary color.Color // TextPositive is the text color associated with a positive event. TextPositive color.Color } @@ -70,17 +80,26 @@ func DefaultFontNames() *FontNames { func DefaultPalette() *Palette { return &Palette{ - Background: color.White, + Background: color.White, + Primary: zntg.MustHexColor(`#3F51B5`), - PrimaryDark: zntg.MustHexColor(`#002884`), + PrimaryDark: zntg.MustHexColor(`#132584`), PrimaryHighlight: zntg.MustHexColor(`#E8EAF6`), - PrimaryLight: zntg.MustHexColor(`#757CE8`), + PrimaryLight: zntg.MustHexColor(`#5E6EC7`), + + Secondary: zntg.MustHexColor(`#FFA441`), + SecondaryDark: zntg.MustHexColor(`#C06605`), + SecondaryHighlight: zntg.MustHexColor(`#FFEFDD`), + SecondaryLight: zntg.MustHexColor(`#FFB564`), + ShadedBackground: zntg.MustHexColor(`#FAFAFA`), - Text: color.Black, - TextDisabled: zntg.MustHexColor(`#BDBDBD`), - TextNegative: zntg.MustHexColor(`#FF4336`), - TextOnPrimary: color.White, - TextPositive: zntg.MustHexColor(`#4CAF50`), + + Text: color.Black, + TextDisabled: zntg.MustHexColor(`#BDBDBD`), + TextNegative: zntg.MustHexColor(`#FF4336`), + TextOnPrimary: color.White, + TextOnSecondary: color.Black, + TextPositive: zntg.MustHexColor(`#4CAF50`), } }