diff --git a/src/components/Utils.gd b/src/components/Utils.gd index 217b109..2ca5097 100644 --- a/src/components/Utils.gd +++ b/src/components/Utils.gd @@ -1,17 +1,25 @@ extends RefCounted class_name Utils +static var main_scene_name: String = ProjectSettings.get_setting("application/run/main_scene") + ## Only works in scene level script static func is_main_scene(_self) -> bool: if _self.get_parent() == _self.get_tree().root \ - and ProjectSettings.get_setting("application/run/main_scene") == _self.scene_file_path: + and main_scene_name == _self.scene_file_path: return true return false +static func get_main_scene(_self: Node) -> Node: + for i in _self.get_tree().root.get_children(): + if i.name == main_scene_name: + return i + return + ## Returns current main scene name static func main_scene(_self) -> String: # Globals always loads first so index of main scene is 1 - var node = _self.get_tree().root.get_child(1) + var node = get_main_scene(_self) if not node: return '' return node.name diff --git a/src/components/colors/TwColors.gd b/src/components/colors/TwColors.gd index 848e575..6c0fd76 100644 --- a/src/components/colors/TwColors.gd +++ b/src/components/colors/TwColors.gd @@ -1,3 +1,6 @@ +extends RefCounted +class_name TwColors + # scraped from https://tailwindcss.com/docs/customizing-colors const tw = { diff --git a/src/globals.gd b/src/globals.gd index ce91fc7..c1c47d2 100644 --- a/src/globals.gd +++ b/src/globals.gd @@ -1,7 +1,7 @@ extends Node class_name Globals -const theme = preload("res://src/themes/BaseTheme.gd").T +const theme = preload("res://src/themes/TwTheme.gd").T const tw = preload('res://src/components/colors/TwColors.gd').tw # Default values for whole project var D = { @@ -12,4 +12,5 @@ var settings := {} # global signals enum FontType {HEX, EMOJI} +@warning_ignore("unused_signal") signal font_changed(new_font: FontType) diff --git a/src/themes/BaseTheme.gd b/src/themes/BaseTheme.gd deleted file mode 100644 index e6bc2e9..0000000 --- a/src/themes/BaseTheme.gd +++ /dev/null @@ -1,18 +0,0 @@ -extends RefCounted - -const T = { - base_color = G.tw.blue._800, - bg_color_menu = G.tw.sky._200, - bg_color_loop = G.tw.sky._400, - figure_variants = { - top_left = G.tw.blue._700, - top_right = G.tw.green._700, - bot_left = G.tw.sky._700, - bot_right = G.tw.orange._700, - bot_mid = G.tw.violet._700, - mid_mid = G.tw.cyan._700, - mid_left = G.tw.amber._700, - mid_right = G.tw.teal._700, - default = G.tw.sky._500, - }, -} diff --git a/src/themes/TwTheme.gd b/src/themes/TwTheme.gd new file mode 100644 index 0000000..d4d8ca7 --- /dev/null +++ b/src/themes/TwTheme.gd @@ -0,0 +1,19 @@ +extends RefCounted +class_name TwTheme + +const T = { + base_color = TwColors.tw.blue._800, + bg_color_menu = TwColors.tw.sky._200, + bg_color_loop = TwColors.tw.sky._400, + figure_variants = { + top_left = TwColors.tw.blue._700, + top_right = TwColors.tw.green._700, + bot_left = TwColors.tw.sky._700, + bot_right = TwColors.tw.orange._700, + bot_mid = TwColors.tw.violet._700, + mid_mid = TwColors.tw.cyan._700, + mid_left = TwColors.tw.amber._700, + mid_right = TwColors.tw.teal._700, + default = TwColors.tw.sky._500, + }, +}