Fix lua themes (#356)

* fix lua themes

* fix project files

* fix project files
This commit is contained in:
Cyano Hao 2024-03-31 08:47:37 +08:00 committed by GitHub
parent 65809f6edf
commit ff393734ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 54 additions and 18 deletions

2
.gitattributes vendored
View File

@ -30,4 +30,4 @@
# generated files # generated files
compiler_hint.lua eol=lf compiler_hint.lua eol=lf
/RedPandaIDE/themes/*.lua eol=lf /RedPandaIDE/resources/themes/*.lua eol=lf

View File

@ -609,7 +609,7 @@ iconsets_files.files += $$files(resources/iconsets/*.svg, true)
iconsets_files.files += $$files(resources/iconsets/*.json, true) iconsets_files.files += $$files(resources/iconsets/*.json, true)
ENABLE_LUA_ADDON { ENABLE_LUA_ADDON {
theme_files.files += $$files(themes/*.lua, false) theme_files.files += $$files(resources/themes/*.lua, false)
} else { } else {
theme_files.files += $$files(resources/themes/*.json, false) theme_files.files += $$files(resources/themes/*.json, false)
} }

View File

@ -6,18 +6,9 @@ function apiVersion()
} }
end end
local nameMap = {
en_US = "One Dark",
pt_BR = "One Dark",
zh_CN = "One Dark",
zh_TW = "One Dark",
}
function main() function main()
local lang = C_Desktop.language()
return { return {
["name"] = nameMap[lang] or nameMap.en_US, ["name"] = "One Dark",
["style"] = "RedPandaDarkFusion", ["style"] = "RedPandaDarkFusion",
["default scheme"] = "One Dark", ["default scheme"] = "One Dark",
["default iconset"] = "contrast", ["default iconset"] = "contrast",
@ -46,7 +37,7 @@ function main()
PaletteBrightText = "#E0E1E3", PaletteBrightText = "#E0E1E3",
PaletteDark = "#282c34", PaletteDark = "#282c34",
PaletteMid = "#282c34", PaletteMid = "#282c34",
PaletteMidLight = "#282c34", PaletteMidlight = "#282c34",
PaletteLight = "#282c34", PaletteLight = "#282c34",
}, },
} }

View File

@ -179,8 +179,9 @@ target("RedPandaIDE")
add_files( add_files(
"resources/iconsets/**.svg", "resources/iconsets/**.json", "resources/iconsets/**.svg", "resources/iconsets/**.json",
"themes/*.png", "resources/themes/*.png",
"colorschemes/*.scheme", "resources/colorschemes/*.scheme",
"resources/fonts/asciicontrol.ttf",
{rule = "RedPandaIDE.auto_qrc"}) {rule = "RedPandaIDE.auto_qrc"})
if is_os("windows") then if is_os("windows") then
@ -199,12 +200,12 @@ target("RedPandaIDE")
"addon/executor.cpp", "addon/executor.cpp",
"addon/runtime.cpp") "addon/runtime.cpp")
add_files( add_files(
"themes/*.lua", "resources/themes/*.lua",
{rule = "RedPandaIDE.auto_qrc"}) {rule = "RedPandaIDE.auto_qrc"})
add_links("lua") add_links("lua")
else else
add_files( add_files(
"themes/*.json", "resources/themes/*.json",
{rule = "RedPandaIDE.auto_qrc"}) {rule = "RedPandaIDE.auto_qrc"})
end end

View File

@ -5,7 +5,7 @@ set -euo pipefail
function gen-theme() { function gen-theme() {
local file="$1" local file="$1"
local bn="$(basename $file)" local bn="$(basename $file)"
local out="RedPandaIDE/themes/${bn%.tl}.lua" local out="RedPandaIDE/resources/themes/${bn%.tl}.lua"
echo -e "\033[1;33mChecking $file\033[0m" echo -e "\033[1;33mChecking $file\033[0m"
tl check --include-dir addon --global-env-def defs/theme --quiet "$file" tl check --include-dir addon --global-env-def defs/theme --quiet "$file"
echo -e "\033[1;32mCompiling $file\033[0m" echo -e "\033[1;32mCompiling $file\033[0m"

44
addon/theme/one_dark.tl Normal file
View File

@ -0,0 +1,44 @@
global function apiVersion(): ApiVersion
return {
kind = "theme",
major = 0,
minor = 1,
}
end
global function main(): Theme
return {
["name"] = "One Dark", -- do not translate
["style"] = "RedPandaDarkFusion",
["default scheme"] = "One Dark",
["default iconset"] = "contrast",
["palette"] = {
PaletteWindow = "#282c34",
PaletteWindowDisabled = "#21252B",
PaletteWindowText = "#9da5b4",
PaletteWindowTextDisabled = "#676D7B",
PaletteBase = "#21252B",
PaletteBaseDisabled = "#1d2026",
PaletteAlternateBase = "#282c34",
PaletteToolTipBase = "#21252B",
PaletteToolTipText = "#9da5b4",
PaletteText = "#b4b4b4",
PaletteTextDisabled = "#676D7B",
PaletteButton = "#2c313c",
PaletteButtonDisabled = "#21252B",
PaletteButtonText = "#9da5b4",
PaletteButtonTextDisabled = "#676D7B",
PaletteHighlight = "#3b4048",
PaletteHighlightDisabled = "#21252B",
PaletteHighlightedText = "#d7dae0",
PaletteHighlightedTextDisabled = "#676D7B",
PaletteLink = "#98c379",
PaletteLinkVisited = "#c9c900",
PaletteBrightText = "#E0E1E3",
PaletteDark = "#282c34",
PaletteMid = "#282c34",
PaletteMidlight = "#282c34",
PaletteLight = "#282c34",
},
}
end