Skip to content

Commit

Permalink
Add notes list pane properties to the theme definition
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnovak committed Jul 3, 2024
1 parent e866fed commit afb8daa
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,29 @@ type
indexColor*: Color
indexBackgroundColor*: array[4, Color]


NotesListPaneTheme* = ref object
controlsBackgroundColor*: Color
listBackgroundColor*: Color

itemBackgroundHoverColor*: Color
itemBackgroundDownColor*: Color
itemBackgroundActiveColor*: Color

itemTextNormalColor*: Color
itemTextHoverColor*: Color
itemTextDownColor*: Color
itemTextActiveColor*: Color

levelSectionBackgroundColor*: Color
levelSectionTextColor*: Color

regionSectionBackgroundColor*: Color
regionSectionTextColor*: Color

scrollBarColor*: Color


ToolbarPaneTheme* = ref object
buttonNormalColor*: Color
buttonHoverColor*: Color
Expand Down
24 changes: 24 additions & 0 deletions src/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -893,6 +893,7 @@ type

sectionPanes: bool
sectionCurrentNotePane: bool
sectionNotesListPane: bool
sectionToolbarPane: bool

focusCaptured: bool
Expand Down Expand Up @@ -9191,6 +9192,29 @@ proc renderThemeEditorProps(x, y, w, h: float; a) =
group:
colorProp("Scroll Bar", p & "scroll-bar")

if koi.subSectionHeader("Notes List Pane", te.sectionNotesListPane):
p = "pane.notes-list."
group:
colorProp("Controls Background", p & "controls-background")
colorProp("List Background", p & "list-background")
group:
colorProp("Item Background Hover", p & "item.background.hover")
colorProp("Item Background Down", p & "item.background.down")
colorProp("Item Background Active", p & "item.background.active")
group:
colorProp("Item Text Normal", p & "item.text.normal")
colorProp("Item Text Hover", p & "item.text.hover")
colorProp("Item Text Down", p & "item.text.down")
colorProp("Item Text Active", p & "item.text.active")
group:
colorProp("Level Section Background", p & "level-section.background")
colorProp("Level Section Text", p & "level-section.text")
group:
colorProp("Region Section Background", p & "region-section.background")
colorProp("Region Section Text", p & "region-section.text")
group:
colorProp("Scroll Bar", p & "scroll-bar")

if koi.subSectionHeader("Toolbar Pane", te.sectionToolbarPane):
p = "pane.toolbar."
colorProp("Button", p & "button.normal")
Expand Down
26 changes: 26 additions & 0 deletions src/theme.nim
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,32 @@ proc toCurrentNotePaneTheme*(cfg: HoconNode): CurrentNotePaneTheme =

cfg.getColorOrDefaultArray("index-background", s.indexBackgroundColor)

# }}}
# {{{ toNotesListPaneTheme*()
proc toNotesListPaneTheme*(cfg: HoconNode): NotesListPaneTheme =
alias(s, result)
s = new NotesListPaneTheme

s.controlsBackgroundColor = cfg.getColorOrDefault("controls-background")
s.listBackgroundColor = cfg.getColorOrDefault("list-background")

s.itemBackgroundHoverColor = cfg.getColorOrDefault("item.background.hover")
s.itemBackgroundDownColor = cfg.getColorOrDefault("item.background.down")
s.itemBackgroundActiveColor = cfg.getColorOrDefault("item.background.active")

s.itemTextNormalColor = cfg.getColorOrDefault("item.text.normal")
s.itemTextHoverColor = cfg.getColorOrDefault("item.text.hover")
s.itemTextDownColor = cfg.getColorOrDefault("item.text.down")
s.itemTextActiveColor = cfg.getColorOrDefault("item.text.active")

s.levelSectionBackgroundColor = cfg.getColorOrDefault("level-section.background")
s.levelSectionTextColor = cfg.getColorOrDefault("level-section.text")

s.regionSectionBackgroundColor = cfg.getColorOrDefault("region-section.background")
s.regionSectionTextColor = cfg.getColorOrDefault("region-section.text")

s.scrollBarColor = cfg.getColorOrDefault("scroll-bar")

# }}}
# {{{ toToolbarPaneTheme*()
proc toToolbarPaneTheme*(cfg: HoconNode): ToolbarPaneTheme =
Expand Down

0 comments on commit afb8daa

Please sign in to comment.