Changed palette (added PrimaryDark color and changed PrimaryHighlight and PrimaryLight colors).

This commit is contained in:
Sander Schobers 2019-04-11 20:02:15 +02:00
parent 3390d46f34
commit 28af8aba06
4 changed files with 10 additions and 7 deletions

View File

@ -73,10 +73,10 @@ func (b *Button) fillColor(p *Palette) color.Color {
if b.over {
switch b.Type {
case ButtonTypeContained:
return p.PrimaryHighlight
return p.PrimaryLight
case ButtonTypeIcon:
default:
return p.PrimaryLight
return p.PrimaryHighlight
}
}
switch b.Type {

View File

@ -85,7 +85,7 @@ func (h *ScrollbarHandle) Render(ctx Context) {
p := ctx.Style().Palette
fill := p.Primary
if h.over {
fill = p.PrimaryHighlight
fill = p.PrimaryLight
}
ctx.Renderer().FillRectangle(h.bounds.Inset(1), fill)
}

View File

@ -21,7 +21,9 @@ type Palette struct {
Background color.Color
// Primary is used as a the main contrast color.
Primary color.Color
// PrimaryHighlight is a highlighted version of the main contrast color.
// PrimaryDark is a foreground version of the main contrast color.
PrimaryDark color.Color
// PrimaryHighlight is a light version of the main contrast color.
PrimaryHighlight color.Color
// PrimaryLight is a background version of the main contrast color.
PrimaryLight color.Color
@ -65,8 +67,9 @@ func DefaultPalette() *Palette {
defaultPalette = &Palette{
Background: color.White,
Primary: RGBA(0x3F, 0x51, 0xB5, 0xFF),
PrimaryHighlight: RGBA(0x5C, 0x6B, 0xC0, 0xFF),
PrimaryLight: RGBA(0xE8, 0xEA, 0xF6, 0xFF),
PrimaryDark: RGBA(0x00, 0x28, 0x84, 0xFF),
PrimaryHighlight: RGBA(0xE8, 0xEA, 0xF6, 0xFF),
PrimaryLight: RGBA(0x75, 0x7C, 0xE8, 0xFF),
ShadedBackground: RGBA(0xFA, 0xFA, 0xFA, 0xFF),
Text: color.Black,
TextDisabled: RGBA(0xBD, 0xBD, 0xBD, 0xFF),

View File

@ -233,7 +233,7 @@ func (b *TextBox) Render(ctx Context) {
renderer.Clear(color.Transparent)
if b.Selection.Start != b.Selection.End {
left, right := renderer.Font(f).WidthOf(b.Text[:b.Selection.Start]), renderer.Font(f).WidthOf(b.Text[:b.Selection.End])
renderer.FillRectangle(geom.RectF32(left, 0, right, size.Y), style.Palette.PrimaryLight)
renderer.FillRectangle(geom.RectF32(left, 0, right, size.Y), style.Palette.PrimaryHighlight)
}
renderer.Text(geom.ZeroPtF32, f, c, b.Text)
const interval = 500 * time.Millisecond