Skip to content

Commit

Permalink
use main color scheme instead of separate canvas scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Jul 6, 2024
1 parent 51da042 commit 35e0792
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
36 changes: 0 additions & 36 deletions canvas/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}
}
6 changes: 3 additions & 3 deletions canvas/svg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
}
Expand Down

0 comments on commit 35e0792

Please sign in to comment.