From a386c7cc16f7c2f374908424f4703a66e339bee9 Mon Sep 17 00:00:00 2001 From: dam Date: Thu, 23 Jun 2022 11:03:00 +0000 Subject: Implemented day and night themes. --- icons/icon.png | Bin 43811 -> 43664 bytes icons/icon.xcf | Bin 151900 -> 109469 bytes icons/icon_foreground.png | Bin 6327 -> 5625 bytes main.gd | 8 +++-- themes/day.tres | 65 ++++++++++++++++++++++++++++------------ themes/night.tres | 5 ++-- ui/modal_popup/modal_popup.gd | 3 +- ui/modal_popup/modal_popup.tscn | 1 - 8 files changed, 55 insertions(+), 27 deletions(-) diff --git a/icons/icon.png b/icons/icon.png index 95c7db3..ff58326 100755 Binary files a/icons/icon.png and b/icons/icon.png differ diff --git a/icons/icon.xcf b/icons/icon.xcf index 57986fb..c011882 100644 Binary files a/icons/icon.xcf and b/icons/icon.xcf differ diff --git a/icons/icon_foreground.png b/icons/icon_foreground.png index 919f2ff..fb7b98b 100644 Binary files a/icons/icon_foreground.png and b/icons/icon_foreground.png differ diff --git a/main.gd b/main.gd index 5d17d68..09e1963 100644 --- a/main.gd +++ b/main.gd @@ -6,6 +6,7 @@ var themes := [ preload("res://themes/day.tres") as Theme, preload("res://themes/night.tres") as Theme ] +var os_name := OS.get_name() onready var settings := Settings.new() onready var popup := get_node("/root/main/popup") as ModalPopup @@ -22,7 +23,7 @@ func _init(): Physics2DServer.set_active(false) PhysicsServer.set_active(false) - if OS.get_name() == "Android": + if os_name == "Android": var permissions := Array(OS.get_granted_permissions()) if permissions.has("android.permission.READ_EXTERNAL_STORAGE") == false \ or permissions.has("android.permission.WRITE_EXTERNAL_STORAGE") == false: @@ -30,6 +31,9 @@ func _init(): func _ready(): + if os_name != "Android" && os_name != "iOS": + get_tree().set_screen_stretch (SceneTree.STRETCH_MODE_DISABLED, SceneTree.STRETCH_ASPECT_IGNORE, Vector2.ONE, 0.75) + Input.set_use_accumulated_input(false) apply_theme(settings.get_value("theme_index", 0)) keyboard_height_offset = OS.get_virtual_keyboard_height() @@ -82,7 +86,7 @@ func toggle_theme(): func apply_theme(theme_idx: int) -> void: - self.theme = themes[theme_idx] + self.theme = themes[theme_idx%themes.size()] # Avoids out-of-array index. VisualServer.set_default_clear_color(get_color("background", "Misc")) diff --git a/themes/day.tres b/themes/day.tres index 375928a..c7f25eb 100644 --- a/themes/day.tres +++ b/themes/day.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=18 format=2] +[gd_resource type="Theme" load_steps=19 format=2] [ext_resource path="res://fonts/font_regular.tres" type="DynamicFont" id=1] [ext_resource path="res://fonts/font_mono_regular.tres" type="DynamicFont" id=2] @@ -10,7 +10,7 @@ content_margin_right = 10.0 [sub_resource type="StyleBoxFlat" id=2] content_margin_left = 10.0 content_margin_right = 10.0 -bg_color = Color( 1, 0.34, 0.34, 1 ) +bg_color = Color( 0.494118, 0.737255, 0.878431, 0.498039 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 @@ -19,22 +19,23 @@ corner_radius_bottom_left = 15 [sub_resource type="StyleBoxFlat" id=22] content_margin_left = 10.0 content_margin_right = 10.0 -bg_color = Color( 1, 0.231373, 0.231373, 1 ) +bg_color = Color( 0.341176, 0.756863, 1, 0.909804 ) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color( 0.2, 0.2, 0.2, 1 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 corner_radius_bottom_left = 15 -[sub_resource type="StyleBoxEmpty" id=24] +[sub_resource type="StyleBoxEmpty" id=25] [sub_resource type="StyleBoxFlat" id=4] content_margin_left = 10.0 content_margin_right = 10.0 -bg_color = Color( 0.475, 0.696667, 0.95, 0.870588 ) -border_width_left = 5 -border_width_top = 5 -border_width_right = 5 -border_width_bottom = 5 +bg_color = Color( 0.45098, 0.8, 1, 0.870588 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 @@ -51,7 +52,7 @@ content_margin_right = 10.0 bg_color = Color( 0, 0, 0, 0 ) draw_center = false border_width_bottom = 4 -border_color = Color( 0.475, 0.696667, 0.95, 0.870588 ) +border_color = Color( 0.34, 0.758, 1, 0.909804 ) [sub_resource type="StyleBoxFlat" id=7] content_margin_left = 10.0 @@ -62,16 +63,36 @@ border_width_bottom = 2 border_color = Color( 0.329412, 0.329412, 0.329412, 1 ) [sub_resource type="StyleBoxFlat" id=23] +content_margin_left = 10.0 +content_margin_right = 10.0 +content_margin_top = 15.0 +bg_color = Color( 0, 0, 0, 0 ) +border_width_bottom = 2 +border_color = Color( 0, 0, 0, 0.301961 ) +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 + +[sub_resource type="StyleBoxFlat" id=24] +content_margin_left = 10.0 +content_margin_right = 10.0 +content_margin_top = 15.0 +bg_color = Color( 0.34, 0.758, 1, 0.909804 ) +border_width_bottom = 2 +border_color = Color( 0.2, 0.2, 0.2, 1 ) +corner_radius_top_left = 15 +corner_radius_top_right = 15 +corner_radius_bottom_right = 15 +corner_radius_bottom_left = 15 [sub_resource type="StyleBoxFlat" id=12] -bg_color = Color( 0.85098, 0.85098, 0.85098, 1 ) +bg_color = Color( 1, 1, 1, 1 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 corner_radius_bottom_left = 15 [sub_resource type="StyleBoxFlat" id=20] -bg_color = Color( 0.615686, 0.776471, 0.94902, 0.784314 ) +bg_color = Color( 0.494118, 0.737255, 0.878431, 0.498039 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 @@ -84,21 +105,21 @@ content_margin_left = 20.0 content_margin_right = 20.0 content_margin_top = 10.0 content_margin_bottom = 10.0 -bg_color = Color( 0.85, 0.85, 0.85, 1 ) +bg_color = Color( 0.9, 0.9, 0.9, 1 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 corner_radius_bottom_left = 15 [sub_resource type="StyleBoxFlat" id=18] -bg_color = Color( 0.223529, 0.352941, 0.501961, 0.784314 ) +bg_color = Color( 0.2244, 0.50028, 0.66, 0.784314 ) corner_radius_top_left = 10 corner_radius_top_right = 10 corner_radius_bottom_right = 10 corner_radius_bottom_left = 10 [sub_resource type="StyleBoxFlat" id=19] -bg_color = Color( 0.337255, 0.529412, 0.74902, 0.870588 ) +bg_color = Color( 0.34, 0.758, 1, 0.909804 ) corner_radius_top_left = 10 corner_radius_top_right = 10 corner_radius_bottom_right = 10 @@ -109,7 +130,7 @@ content_margin_left = 20.0 [resource] default_font = ExtResource( 1 ) -Button/colors/font_color = Color( 0.121569, 0.121569, 0.121569, 1 ) +Button/colors/font_color = Color( 0.12, 0.12, 0.12, 1 ) Button/colors/font_color_disabled = Color( 0.1, 0.1, 0.1, 0.2 ) Button/colors/font_color_focus = Color( 0.06, 0.06, 0.06, 1 ) Button/colors/font_color_hover = Color( 0.06, 0.06, 0.06, 1 ) @@ -121,9 +142,9 @@ Button/styles/normal = SubResource( 2 ) Button/styles/pressed = SubResource( 22 ) ItemList/colors/font_color = Color( 0.37, 0.37, 0.37, 1 ) ItemList/colors/font_color_selected = Color( 0, 0, 0, 1 ) -ItemList/colors/guide_color = Color( 1, 0, 0, 0.870588 ) +ItemList/colors/guide_color = Color( 0, 0, 0, 0 ) ItemList/fonts/font = ExtResource( 2 ) -ItemList/styles/bg = SubResource( 24 ) +ItemList/styles/bg = SubResource( 25 ) ItemList/styles/selected = SubResource( 4 ) ItemList/styles/selected_focus = SubResource( 4 ) Label/colors/font_color = Color( 0, 0, 0, 1 ) @@ -131,15 +152,21 @@ Label/styles/normal = SubResource( 21 ) LineEdit/colors/cursor_color = Color( 0.06, 0.06, 0.06, 1 ) LineEdit/colors/font_color = Color( 0.12, 0.12, 0.12, 1 ) LineEdit/colors/font_color_selected = Color( 1, 1, 1, 1 ) +LineEdit/colors/font_color_uneditable = Color( 0.12, 0.12, 0.12, 0.501961 ) +LineEdit/colors/selection_color = Color( 0.51, 0.51, 0.51, 1 ) LineEdit/styles/focus = SubResource( 9 ) LineEdit/styles/normal = SubResource( 7 ) LineEdit/styles/read_only = null Misc/colors/background = Color( 1, 1, 1, 1 ) +Misc/colors/modal_filter = Color( 0.901961, 0.901961, 0.901961, 0.94902 ) OptionSetList/styles/normal = SubResource( 23 ) -OptionSetList/styles/selected = SubResource( 23 ) +OptionSetList/styles/selected = SubResource( 24 ) Panel/styles/panel = SubResource( 12 ) PopupMenu/colors/font_color = Color( 0.12, 0.12, 0.12, 1 ) +PopupMenu/colors/font_color_accel = Color( 0.3, 0.3, 0.3, 0.8 ) +PopupMenu/colors/font_color_disabled = Color( 0.6, 0.6, 0.6, 0.8 ) PopupMenu/colors/font_color_hover = Color( 0.12, 0.12, 0.12, 1 ) +PopupMenu/colors/font_color_separator = Color( 0.12, 0.12, 0.12, 1 ) PopupMenu/constants/vseparation = 20 PopupMenu/styles/hover = SubResource( 20 ) PopupMenu/styles/panel = SubResource( 13 ) diff --git a/themes/night.tres b/themes/night.tres index 60ec11a..4f24b86 100644 --- a/themes/night.tres +++ b/themes/night.tres @@ -76,8 +76,6 @@ content_margin_left = 10.0 content_margin_right = 10.0 content_margin_top = 15.0 bg_color = Color( 0.54902, 0.0666667, 0.0666667, 0.909804 ) -border_width_left = 2 -border_width_right = 2 border_width_bottom = 2 corner_radius_top_left = 15 corner_radius_top_right = 15 @@ -105,7 +103,7 @@ content_margin_left = 20.0 content_margin_right = 20.0 content_margin_top = 10.0 content_margin_bottom = 10.0 -bg_color = Color( 0.15, 0.15, 0.15, 1 ) +bg_color = Color( 0.14902, 0.14902, 0.14902, 1 ) corner_radius_top_left = 15 corner_radius_top_right = 15 corner_radius_bottom_right = 15 @@ -145,6 +143,7 @@ LineEdit/styles/focus = SubResource( 9 ) LineEdit/styles/normal = SubResource( 7 ) LineEdit/styles/read_only = null Misc/colors/background = Color( 0, 0, 0, 1 ) +Misc/colors/modal_filter = Color( 0.101961, 0.101961, 0.101961, 0.94902 ) OptionSetList/styles/normal = SubResource( 23 ) OptionSetList/styles/selected = SubResource( 24 ) Panel/styles/panel = SubResource( 12 ) diff --git a/ui/modal_popup/modal_popup.gd b/ui/modal_popup/modal_popup.gd index 2a45f38..067eccb 100644 --- a/ui/modal_popup/modal_popup.gd +++ b/ui/modal_popup/modal_popup.gd @@ -42,8 +42,7 @@ func open_popup(title: String, item: Control): if visible == true: return - self.color = get_color("background", "Misc") - self.color.a = 0.85 + self.color = get_color("modal_filter", "Misc") self.title.text = title control = item diff --git a/ui/modal_popup/modal_popup.tscn b/ui/modal_popup/modal_popup.tscn index 4ee5939..7a8f5c6 100644 --- a/ui/modal_popup/modal_popup.tscn +++ b/ui/modal_popup/modal_popup.tscn @@ -7,7 +7,6 @@ visible = false anchor_right = 1.0 anchor_bottom = 1.0 -color = Color( 0, 0, 0, 0.870588 ) script = ExtResource( 1 ) [node name="background" type="Panel" parent="."] -- cgit v1.2.3