make ListHeader color independently customizable
This commit is contained in:
+1
-1
@@ -143,7 +143,7 @@ var ResFilterSvg = &fyne.StaticResource{
|
||||
var ResDefaultToml = &fyne.StaticResource{
|
||||
StaticName: "default.toml",
|
||||
StaticContent: []byte(
|
||||
"[SupersonicTheme]\nName = \"Default\"\nVersion = \"0.1\"\nSupportsDark = true\nSupportsLight = true\n\n[DarkColors]\nPageBackground = \"#0F0F0F\"\nBackground = \"#232323\"\nScrollBar = \"#F3F3F3\"\nButton = \"#14141432\"\nInputBackground = \"#14141432\"\n\n[LightColors]\nPageBackground = \"#FAFAFA\"\nBackground = \"#E1DFE1\"\nScrollBar = \"#565656\"\nButton = \"#C8C8C8F0\"\nDisabledButton = \"#CDCDCDF0\"\nForeground = \"#0A0A0A\"\nPrimary = \"#1919FA\""),
|
||||
"[SupersonicTheme]\nName = \"Default\"\nVersion = \"0.1\"\nSupportsDark = true\nSupportsLight = true\n\n[DarkColors]\nPageBackground = \"#0F0F0F\"\nListHeader = \"#232323\"\nBackground = \"#232323\"\nScrollBar = \"#F3F3F3\"\nButton = \"#14141432\"\nInputBackground = \"#14141432\"\n\n[LightColors]\nPageBackground = \"#FAFAFA\"\nListHeader = \"#E1DFE1\"\nBackground = \"#E1DFE1\"\nScrollBar = \"#565656\"\nButton = \"#C8C8C8F0\"\nDisabledButton = \"#CDCDCDF0\"\nForeground = \"#0A0A0A\"\nPrimary = \"#1919FA\""),
|
||||
}
|
||||
var ResLICENSE = &fyne.StaticResource{
|
||||
StaticName: "LICENSE",
|
||||
|
||||
@@ -6,6 +6,7 @@ SupportsLight = true
|
||||
|
||||
[DarkColors]
|
||||
PageBackground = "#0F0F0F"
|
||||
ListHeader = "#232323"
|
||||
Background = "#232323"
|
||||
ScrollBar = "#F3F3F3"
|
||||
Button = "#14141432"
|
||||
@@ -13,6 +14,7 @@ InputBackground = "#14141432"
|
||||
|
||||
[LightColors]
|
||||
PageBackground = "#FAFAFA"
|
||||
ListHeader = "#E1DFE1"
|
||||
Background = "#E1DFE1"
|
||||
ScrollBar = "#565656"
|
||||
Button = "#C8C8C8F0"
|
||||
|
||||
+6
-1
@@ -18,7 +18,10 @@ import (
|
||||
"fyne.io/fyne/v2/theme"
|
||||
)
|
||||
|
||||
const ColorNamePageBackground fyne.ThemeColorName = "PageBackground"
|
||||
const (
|
||||
ColorNameListHeader fyne.ThemeColorName = "ListHeader"
|
||||
ColorNamePageBackground fyne.ThemeColorName = "PageBackground"
|
||||
)
|
||||
|
||||
type AppearanceMode string
|
||||
|
||||
@@ -80,6 +83,8 @@ func (m *MyTheme) Color(name fyne.ThemeColorName, _ fyne.ThemeVariant) color.Col
|
||||
defColors = m.defaultThemeFile.LightColors
|
||||
}
|
||||
switch name {
|
||||
case ColorNameListHeader:
|
||||
return colorOrDefault(colors.ListHeader, defColors.ListHeader, name, variant)
|
||||
case ColorNamePageBackground:
|
||||
return colorOrDefault(colors.PageBackground, defColors.PageBackground, name, variant)
|
||||
case theme.ColorNameBackground:
|
||||
|
||||
@@ -32,6 +32,8 @@ type ThemeFile struct {
|
||||
type ThemeColors struct {
|
||||
// Supersonic-specific colors
|
||||
|
||||
ListHeader string
|
||||
|
||||
PageBackground string
|
||||
|
||||
// Fyne colors
|
||||
|
||||
@@ -62,7 +62,7 @@ func NewListHeader(cols []ListColumn, layout *layouts.ColumnsLayout) *ListHeader
|
||||
for i := range l.columnVisible {
|
||||
l.columnVisible[i] = true
|
||||
}
|
||||
l.container = container.NewMax(myTheme.NewThemedRectangle(theme.ColorNameBackground), l.columnsContainer)
|
||||
l.container = container.NewMax(myTheme.NewThemedRectangle(myTheme.ColorNameListHeader), l.columnsContainer)
|
||||
l.ExtendBaseWidget(l)
|
||||
l.buildColumns()
|
||||
return l
|
||||
|
||||
Reference in New Issue
Block a user