diff --git a/server/pkg/sass/processor.go b/server/pkg/sass/processor.go index 3aaad8f38..a92cc5d3a 100644 --- a/server/pkg/sass/processor.go +++ b/server/pkg/sass/processor.go @@ -58,7 +58,7 @@ func DefaultCSS(log *zap.Logger, customCSS string) string { func Transpile(transpiler *godartsass.Transpiler, log *zap.Logger, themeID, themeSASS, customCSS, sassDirPath string) (err error) { // process root section - err = processSass(transpiler, log, SectionRoot, themeID, themeSASS, customCSS, sassDirPath) + err = processSass(transpiler, log, SectionRoot, themeID, themeSASS, "", sassDirPath) if err != nil { return err } diff --git a/server/system/service/stylesheet.go b/server/system/service/stylesheet.go index 35b121c2f..724d9ff0a 100644 --- a/server/system/service/stylesheet.go +++ b/server/system/service/stylesheet.go @@ -65,10 +65,19 @@ func GenerateCSS(settings *types.AppSettings, sassDirPath string, log *zap.Logge func processCustomCSS(themeID string, customCSSMap map[string]string) (customCSS string) { var stringsBuilder strings.Builder + // add theme mode on customCSS + if themeID == sass.DarkTheme { + stringsBuilder.WriteString(fmt.Sprintf("\n[data-color-mode=\"%s\"] {\n", themeID)) + } + stringsBuilder.WriteString(customCSSMap[sass.GeneralTheme]) stringsBuilder.WriteString("\n") stringsBuilder.WriteString(customCSSMap[themeID]) + if themeID == sass.DarkTheme { + stringsBuilder.WriteString("}\n") + } + return stringsBuilder.String() }