From 35e07923b883c5efe29b9d5faf7557a64285be9a Mon Sep 17 00:00:00 2001 From: Kai O'Reilly Date: Sat, 6 Jul 2024 14:23:20 -0700 Subject: [PATCH] use main color scheme instead of separate canvas scheme --- canvas/settings.go | 36 ------------------------------------ canvas/svg.go | 6 +++--- 2 files changed, 3 insertions(+), 39 deletions(-) diff --git a/canvas/settings.go b/canvas/settings.go index 34f67c9b..971a8267 100644 --- a/canvas/settings.go +++ b/canvas/settings.go @@ -5,13 +5,11 @@ package canvas import ( - "image/color" "os" "path/filepath" "slices" "cogentcore.org/core/base/iox/tomlx" - "cogentcore.org/core/colors" "cogentcore.org/core/core" "cogentcore.org/core/styles" ) @@ -37,9 +35,6 @@ type SettingsData struct { //types:add // default physical size, when app is started without opening a file Size PhysSize - // active color settings - Colors ColorSettings - // default shape styles ShapeStyle styles.Paint @@ -76,7 +71,6 @@ type SettingsData struct { //types:add func (se *SettingsData) Defaults() { se.Size.Defaults() - se.Colors.Defaults() se.ShapeStyle.Defaults() se.ShapeStyle.FontStyle.Family = "Arial" se.ShapeStyle.FontStyle.Size.Px(12) @@ -132,33 +126,3 @@ func (se *SettingsData) Apply() { //types:add func (se *SettingsData) EditSplits() { SplitsView(&AvailableSplits) } - -///////////////////////////////////////////////////////////////////////////////// -// ColorSettings - -// ColorSettings for -type ColorSettings struct { //types:add - - // drawing background color - Background color.Color - - // border color of the drawing - Border color.Color - - // grid line color - Grid color.Color -} - -// todo: replace with color tone defaults - -func (se *ColorSettings) Defaults() { - se.Background = colors.White - se.Border = colors.Black - se.Grid = color.RGBA{220, 220, 220, 255} -} - -func (se *ColorSettings) DarkDefaults() { - se.Background = colors.Black - se.Border = color.RGBA{102, 102, 102, 255} - se.Grid = color.RGBA{40, 40, 40, 255} -} diff --git a/canvas/svg.go b/canvas/svg.go index 316b243f..d9c506e0 100644 --- a/canvas/svg.go +++ b/canvas/svg.go @@ -941,13 +941,13 @@ func (sv *SVG) RenderBg() { } sv.UpdateGridEff() bb := sv.bgPixels.Bounds() - draw.Draw(sv.bgPixels, bb, &image.Uniform{Settings.Colors.Background}, image.ZP, draw.Src) + draw.Draw(sv.bgPixels, bb, colors.Scheme.Surface, image.ZP, draw.Src) pc := &sv.bgPaint pc.PushBounds(bb) pc.PushTransform(root.Paint.Transform) - pc.StrokeStyle.Color = colors.Uniform(Settings.Colors.Border) + pc.StrokeStyle.Color = colors.Scheme.OnSurface sc := sv.SVG.Scale @@ -962,7 +962,7 @@ func (sv *SVG) RenderBg() { if Settings.GridDisp { gsz := float32(sv.GridEff) - pc.StrokeStyle.Color = colors.Uniform(Settings.Colors.Grid) + pc.StrokeStyle.Color = colors.Scheme.OutlineVariant for x := gsz; x < sz.X; x += gsz { pc.DrawLine(x, 0, x, sz.Y) }