Add darkmode on customCSS
This commit is contained in:
parent
cbcf3dd422
commit
88608fbb08
@ -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
|
||||
}
|
||||
|
||||
@ -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()
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user