Skip to content

Commit

Permalink
disable_glow() for Themes
Browse files Browse the repository at this point in the history
  • Loading branch information
face-hh committed Mar 30, 2024
1 parent f06086b commit ab05533
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Lua/Themes/Catppuccin Latte.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
disable_glow()

set_keywords("reserved", "8839ef") --- Mauve
set_keywords("string", "40a02b") --- Green
set_keywords("binary", "fe640b") --- Peach
Expand Down
2 changes: 2 additions & 0 deletions Lua/Themes/GitHub Light.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
disable_glow()

set_keywords("reserved", "cf222e")
set_keywords("string", "0a3069")
set_keywords("binary", "0550ae")
Expand Down
2 changes: 2 additions & 0 deletions Lua/Themes/Kanagawa Lotus.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
disable_glow()

set_keywords("reserved", "624c83")
set_keywords("string", "6f894e")
set_keywords("binary", "ffa066")
Expand Down
4 changes: 3 additions & 1 deletion Lua/Themes/Tokyo Night Light.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
disable_glow()

set_keywords("reserved", "5a4a78")
set_keywords("string", "485e30")
set_keywords("binary", "965027")
Expand All @@ -17,4 +19,4 @@ set_gui("font_color", "565a6e")
set_gui("word_highlighted_color", "0f0f14")
set_gui("completion_background_color", "0f0f14")
set_gui("completion_selected_color", "24283b")
set_gui("caret_color", "9aa5ce")
set_gui("caret_color", "9aa5ce")
4 changes: 3 additions & 1 deletion Lua/Themes/Tokyo Night Storm.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
disable_glow()

set_keywords("reserved", "bb9af7")
set_keywords("string", "9ece6a")
set_keywords("binary", "ff9e64")
Expand All @@ -17,4 +19,4 @@ set_gui("font_color", "9aa5ce")
set_gui("word_highlighted_color", "414868")
set_gui("completion_background_color", "24283b")
set_gui("completion_selected_color", "414868")
set_gui("caret_color", "9aa5ce")
set_gui("caret_color", "9aa5ce")
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ To add a theme, create a file in the **"themes"** folder with any name. (i.e. "d
| -------- | -------- | -------- | -------- |
| `set_keywords(property: String, new_color: String)` | `set_keywords("reserved", "#ff00ff")` | Set the color of syntax highlighting. | The second argument must be a hex, `#` being optional. Available colors/properties listed above at `langs`. |
| `set_gui(property: String, new_color: String)` | `set_gui("background_color", "#ff00ff")` | This method is dedicated to the overall GUI aspect of GriddyCode. | Available properties: `background_color`, `current_line_color`, `selection_color`, `font_color`, `word_highlighted_color`, `selection_background_color`. Properties except `background_color`, if not provided, will be set to a slightly modified version of `background_color`. Although possible, we don't recommend you rely on those & instead set all the values. |
| `disable_glow()` | `disable_glow()` | Disables the "glow" setting. | This exists because Godot's *glow* seems to mess up on light colors. Not adding this on light themes may result in the entire screen going white. |

*Note: if the HEX you input is invalid, it will default to #ff0000 (red)*

Expand Down
2 changes: 1 addition & 1 deletion Scripts/file_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func warn(notice: String) -> void:

node.set_notice(notice)

get_tree().create_timer(3).timeout.connect(func():
get_tree().create_timer(5).timeout.connect(func():
node.queue_free()
)

Expand Down
8 changes: 6 additions & 2 deletions Scripts/lua_singleton.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var themes: Array = ["One Dark Pro Darker"];
var theme: String = "One Dark Pro Darker"; # default

# TODO: change me each version
var version: String = "v1.1.1";
var version: String = "v1.2.0";

var gui: Dictionary = {
"background_color": str_to_clr("#23272e"),
Expand Down Expand Up @@ -335,7 +335,6 @@ func handle_internal_setting_change(property: String, value: Variant) -> void:
editor_theme.set_font("font", "CodeEdit", fonts[value].value)
editor_theme.set_font("font", "Button", fonts[value].value)


# SHADERS
if p == "glow":
world_environment.environment.glow_enabled = value
Expand Down Expand Up @@ -387,6 +386,10 @@ func _lua_set_keywords(property: String, new_color: String) -> void:

keywords[property] = str_to_clr(new_color)

func _lua_disable_glow() -> void:
editor.warn("[color=yellow]WARNING[/color]: This theme disabled the \"glow\".")
handle_internal_setting_change("glow", false)

func _lua_set_gui(property: String, new_color: String) -> void:
if !(property in gui.keys()):
print("ERROR: provided color property (\"%s\") in theme (GUI) is invalid." % [property])
Expand Down Expand Up @@ -425,6 +428,7 @@ func setup_extension(extension):
func setup_theme(given_theme: String) -> void:
theme_lua.bind_libraries(["base", "table", "string"])

theme_lua.push_variant("disable_glow", _lua_disable_glow)
theme_lua.push_variant("set_keywords", _lua_set_keywords)
theme_lua.push_variant("set_gui", _lua_set_gui)

Expand Down

0 comments on commit ab05533

Please sign in to comment.