Skip to content

Commit

Permalink
🎨 Use real theme style value replace var in preview mode #11458
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Nov 17, 2024
1 parent 317e84d commit 35d1c10
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/model/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"path/filepath"
"strings"

"github.com/88250/gulu"
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/gorilla/css/scanner"
Expand Down Expand Up @@ -54,6 +55,10 @@ func fillThemeStyleVar(tree *parse.Tree) {
buf.WriteString(style)
buf.WriteString(": ")
value := themeStyles[name]
if strings.Contains(value, "-b3-") {
name = gulu.Str.SubStringBetween(value, "(", ")")
value = themeStyles[name]
}
if "" == value {
// 回退为变量
buf.WriteString("var(")
Expand Down

0 comments on commit 35d1c10

Please sign in to comment.