mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Theme code cleaning and tidying
This commit is contained in:
parent
290e8cdb18
commit
71dcb9807d
|
@ -1442,6 +1442,7 @@ shadow_color = Color( 0, 0, 0, 0.3 )
|
|||
shadow_size = 4
|
||||
|
||||
[resource]
|
||||
resource_name = "Blue"
|
||||
default_font = ExtResource( 1 )
|
||||
BoxContainer/constants/separation = 4
|
||||
Button/colors/font_color = Color( 0.8, 0.8075, 0.8275, 1 )
|
||||
|
@ -1560,6 +1561,7 @@ HSlider/styles/slider = SubResource( 82 )
|
|||
HSplitContainer/constants/separation = 8
|
||||
HSplitContainer/icons/grabber = SubResource( 84 )
|
||||
HSplitContainer/styles/bg = SubResource( 85 )
|
||||
Icons/colors/modulate_color = Color( 0.74902, 0.74902, 0.74902, 1 )
|
||||
ItemList/colors/font_color = Color( 0.8, 0.8075, 0.8275, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 )
|
||||
ItemList/colors/guide_color = Color( 1, 1, 1, 0.05 )
|
||||
|
|
|
@ -1467,6 +1467,7 @@ shadow_color = Color( 0, 0, 0, 0.1 )
|
|||
shadow_size = 4
|
||||
|
||||
[resource]
|
||||
resource_name = "Caramel"
|
||||
default_font = ExtResource( 1 )
|
||||
BoxContainer/constants/separation = 4
|
||||
Button/colors/font_color = Color( 0.237305, 0.193295, 0.141827, 1 )
|
||||
|
@ -1607,6 +1608,7 @@ HSplitContainer/constants/autohide = 1
|
|||
HSplitContainer/constants/separation = 8
|
||||
HSplitContainer/icons/grabber = SubResource( 86 )
|
||||
HSplitContainer/styles/bg = SubResource( 87 )
|
||||
Icons/colors/modulate_color = Color( 0.2, 0.2, 0.2, 1 )
|
||||
ItemList/colors/font_color = Color( 0.237305, 0.193295, 0.141827, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 0, 0, 0, 1 )
|
||||
ItemList/colors/guide_color = Color( 0, 0, 0, 0.05 )
|
||||
|
|
|
@ -1505,6 +1505,7 @@ shadow_color = Color( 0, 0, 0, 0.3 )
|
|||
shadow_size = 4
|
||||
|
||||
[resource]
|
||||
resource_name = "Dark"
|
||||
default_font = ExtResource( 1 )
|
||||
BoxContainer/constants/separation = 4
|
||||
Button/colors/font_color = Color( 0.77832, 0.77832, 0.77832, 1 )
|
||||
|
@ -1650,6 +1651,7 @@ HSplitContainer/constants/autohide = 1
|
|||
HSplitContainer/constants/separation = 8
|
||||
HSplitContainer/icons/grabber = SubResource( 90 )
|
||||
HSplitContainer/styles/bg = SubResource( 91 )
|
||||
Icons/colors/modulate_color = Color( 0.74902, 0.74902, 0.74902, 1 )
|
||||
ItemList/colors/font_color = Color( 0.77832, 0.77832, 0.77832, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 )
|
||||
ItemList/colors/guide_color = Color( 1, 1, 1, 0.05 )
|
||||
|
|
|
@ -1506,6 +1506,7 @@ shadow_color = Color( 0, 0, 0, 0.3 )
|
|||
shadow_size = 4
|
||||
|
||||
[resource]
|
||||
resource_name = "Gray"
|
||||
default_font = ExtResource( 1 )
|
||||
BoxContainer/constants/separation = 4
|
||||
Button/colors/font_color = Color( 0.848039, 0.848039, 0.848039, 1 )
|
||||
|
@ -1647,6 +1648,7 @@ HSplitContainer/constants/autohide = 1
|
|||
HSplitContainer/constants/separation = 8
|
||||
HSplitContainer/icons/grabber = SubResource( 89 )
|
||||
HSplitContainer/styles/bg = SubResource( 90 )
|
||||
Icons/colors/modulate_color = Color( 0.74902, 0.74902, 0.74902, 1 )
|
||||
ItemList/colors/font_color = Color( 0.848039, 0.848039, 0.848039, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 )
|
||||
ItemList/colors/guide_color = Color( 1, 1, 1, 0.05 )
|
||||
|
|
|
@ -1506,6 +1506,7 @@ shadow_color = Color( 0, 0, 0, 0.1 )
|
|||
shadow_size = 4
|
||||
|
||||
[resource]
|
||||
resource_name = "Light"
|
||||
default_font = ExtResource( 5 )
|
||||
BoxContainer/constants/separation = 4
|
||||
Button/colors/font_color = Color( 0.25, 0.25, 0.25, 1 )
|
||||
|
@ -1647,6 +1648,7 @@ HSplitContainer/constants/autohide = 1
|
|||
HSplitContainer/constants/separation = 8
|
||||
HSplitContainer/icons/grabber = SubResource( 89 )
|
||||
HSplitContainer/styles/bg = SubResource( 90 )
|
||||
Icons/colors/modulate_color = Color( 0.2, 0.2, 0.2, 1 )
|
||||
ItemList/colors/font_color = Color( 0.25, 0.25, 0.25, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 0, 0, 0, 1 )
|
||||
ItemList/colors/guide_color = Color( 0, 0, 0, 0.05 )
|
||||
|
|
|
@ -1459,6 +1459,7 @@ shadow_color = Color( 0, 0, 0, 0.3 )
|
|||
shadow_size = 4
|
||||
|
||||
[resource]
|
||||
resource_name = "Purple"
|
||||
default_font = ExtResource( 1 )
|
||||
BoxContainer/constants/separation = 4
|
||||
Button/colors/font_color = Color( 0.79902, 0.780392, 0.820588, 1 )
|
||||
|
@ -1572,6 +1573,7 @@ HSlider/styles/slider = SubResource( 83 )
|
|||
HSplitContainer/constants/separation = 8
|
||||
HSplitContainer/icons/grabber = SubResource( 85 )
|
||||
HSplitContainer/styles/bg = SubResource( 86 )
|
||||
Icons/colors/modulate_color = Color( 0.74902, 0.74902, 0.74902, 1 )
|
||||
ItemList/colors/font_color = Color( 0.79902, 0.780392, 0.820588, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 )
|
||||
ItemList/colors/guide_color = Color( 1, 1, 1, 0.05 )
|
||||
|
|
|
@ -2,7 +2,6 @@ extends Node
|
|||
|
||||
enum GridTypes { CARTESIAN, ISOMETRIC, ALL }
|
||||
enum PressureSensitivity { NONE, ALPHA, SIZE, ALPHA_AND_SIZE }
|
||||
enum ThemeTypes { DARK, BLUE, CARAMEL, LIGHT }
|
||||
enum TileMode { NONE, BOTH, X_AXIS, Y_AXIS }
|
||||
enum IconColorFrom { THEME, CUSTOM }
|
||||
enum ButtonSize { SMALL, BIG }
|
||||
|
@ -38,7 +37,6 @@ var smooth_zoom := true
|
|||
|
||||
var shrink := 1.0
|
||||
var dim_on_popup := true
|
||||
var theme_type: int = ThemeTypes.DARK
|
||||
var modulate_icon_color := Color.gray
|
||||
var icon_color_from: int = IconColorFrom.THEME
|
||||
var custom_icon_color := Color.gray
|
||||
|
|
|
@ -533,14 +533,9 @@ func _frame_changed(value: int) -> void:
|
|||
Global.current_frame_mark_label.text = "%s/%s" % [str(current_frame + 1), frames.size()]
|
||||
|
||||
for i in frames.size():
|
||||
var text_color := Color.white
|
||||
if (
|
||||
Global.theme_type == Global.ThemeTypes.CARAMEL
|
||||
|| Global.theme_type == Global.ThemeTypes.LIGHT
|
||||
):
|
||||
text_color = Color.black
|
||||
Global.frame_ids.get_child(i).add_color_override("font_color", text_color)
|
||||
for container in Global.frames_container.get_children(): # De-select all the other frames
|
||||
var frame_button: BaseButton = Global.frame_ids.get_child(i)
|
||||
frame_button.pressed = false
|
||||
for container in Global.frames_container.get_children(): # De-select all the other cels
|
||||
if i < container.get_child_count():
|
||||
container.get_child(i).pressed = false
|
||||
|
||||
|
@ -551,9 +546,9 @@ func _frame_changed(value: int) -> void:
|
|||
var current_frame_tmp: int = cel[0]
|
||||
var current_layer_tmp: int = cel[1]
|
||||
if current_frame_tmp < Global.frame_ids.get_child_count():
|
||||
Global.frame_ids.get_child(current_frame_tmp).add_color_override(
|
||||
"font_color", Global.control.theme.get_color("Selected Color", "Label")
|
||||
)
|
||||
var frame_button: BaseButton = Global.frame_ids.get_child(current_frame_tmp)
|
||||
frame_button.pressed = true
|
||||
|
||||
var container_child_count: int = Global.frames_container.get_child_count()
|
||||
if current_layer_tmp < container_child_count:
|
||||
var container = Global.frames_container.get_child(
|
||||
|
|
|
@ -3,12 +3,12 @@ extends Node
|
|||
var theme_index := 0
|
||||
|
||||
onready var themes := [
|
||||
[preload("res://assets/themes/dark/theme.tres"), "Dark", Color.gray],
|
||||
[preload("res://assets/themes/gray/theme.tres"), "Gray", Color.gray],
|
||||
[preload("res://assets/themes/blue/theme.tres"), "Blue", Color.gray],
|
||||
[preload("res://assets/themes/caramel/theme.tres"), "Caramel", Color(0.2, 0.2, 0.2)],
|
||||
[preload("res://assets/themes/light/theme.tres"), "Light", Color(0.2, 0.2, 0.2)],
|
||||
[preload("res://assets/themes/purple/theme.tres"), "Purple", Color.gray],
|
||||
preload("res://assets/themes/dark/theme.tres"),
|
||||
preload("res://assets/themes/gray/theme.tres"),
|
||||
preload("res://assets/themes/blue/theme.tres"),
|
||||
preload("res://assets/themes/caramel/theme.tres"),
|
||||
preload("res://assets/themes/light/theme.tres"),
|
||||
preload("res://assets/themes/purple/theme.tres"),
|
||||
]
|
||||
|
||||
onready var buttons_container: BoxContainer = $ThemeButtons
|
||||
|
@ -20,15 +20,16 @@ func _ready() -> void:
|
|||
var button_group = ButtonGroup.new()
|
||||
for theme in themes:
|
||||
var button := CheckBox.new()
|
||||
button.name = theme[1]
|
||||
button.text = theme[1]
|
||||
var theme_name: String = theme.resource_name
|
||||
button.name = theme_name
|
||||
button.text = theme_name
|
||||
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||
button.group = button_group
|
||||
buttons_container.add_child(button)
|
||||
button.connect("pressed", self, "_on_Theme_pressed", [button.get_index()])
|
||||
|
||||
var panel_stylebox: StyleBox = theme[0].get_stylebox("panel", "Panel")
|
||||
var panel_container_stylebox: StyleBox = theme[0].get_stylebox("panel", "PanelContainer")
|
||||
var panel_stylebox: StyleBox = theme.get_stylebox("panel", "Panel")
|
||||
var panel_container_stylebox: StyleBox = theme.get_stylebox("panel", "PanelContainer")
|
||||
if panel_stylebox is StyleBoxFlat and panel_container_stylebox is StyleBoxFlat:
|
||||
var theme_color_preview: ColorRect = theme_color_preview_scene.instance()
|
||||
var color1 = panel_stylebox.bg_color
|
||||
|
@ -61,28 +62,20 @@ func _on_Theme_pressed(index: int) -> void:
|
|||
|
||||
func change_theme(id: int) -> void:
|
||||
theme_index = id
|
||||
var main_theme: Theme = themes[id][0]
|
||||
|
||||
if id == 0 or id == 1 or id == 5: # Dark, Gray or Purple Theme
|
||||
Global.theme_type = Global.ThemeTypes.DARK
|
||||
elif id == 2: # Godot's Theme
|
||||
Global.theme_type = Global.ThemeTypes.BLUE
|
||||
elif id == 3: # Caramel Theme
|
||||
Global.theme_type = Global.ThemeTypes.CARAMEL
|
||||
elif id == 4: # Light Theme
|
||||
Global.theme_type = Global.ThemeTypes.LIGHT
|
||||
var theme: Theme = themes[id]
|
||||
var icon_color: Color = theme.get_color("modulate_color", "Icons")
|
||||
|
||||
if Global.icon_color_from == Global.IconColorFrom.THEME:
|
||||
Global.modulate_icon_color = themes[id][2]
|
||||
Global.modulate_icon_color = icon_color
|
||||
|
||||
Global.control.theme = main_theme
|
||||
Global.control.theme = theme
|
||||
|
||||
var panel_stylebox: StyleBox = main_theme.get_stylebox("panel", "PanelContainer")
|
||||
var panel_stylebox: StyleBox = theme.get_stylebox("panel", "PanelContainer")
|
||||
if panel_stylebox is StyleBoxFlat:
|
||||
Global.default_clear_color = panel_stylebox.bg_color
|
||||
else:
|
||||
Global.default_clear_color = themes[id][2]
|
||||
VisualServer.set_default_clear_color(Color(Global.default_clear_color))
|
||||
Global.default_clear_color = icon_color
|
||||
VisualServer.set_default_clear_color(Global.default_clear_color)
|
||||
|
||||
# Temporary code
|
||||
var layer_button_pcont: PanelContainer = Global.animation_timeline.find_node(
|
||||
|
@ -91,8 +84,8 @@ func change_theme(id: int) -> void:
|
|||
var lbpc_stylebox: StyleBoxFlat = layer_button_pcont.get_stylebox("panel", "PanelContainer")
|
||||
lbpc_stylebox.bg_color = Global.default_clear_color
|
||||
|
||||
var top_menu_style = main_theme.get_stylebox("TopMenu", "Panel")
|
||||
var ruler_style = main_theme.get_stylebox("Ruler", "Button")
|
||||
var top_menu_style = theme.get_stylebox("TopMenu", "Panel")
|
||||
var ruler_style = theme.get_stylebox("Ruler", "Button")
|
||||
Global.top_menu_container.add_stylebox_override("panel", top_menu_style)
|
||||
Global.horizontal_ruler.add_stylebox_override("normal", ruler_style)
|
||||
Global.horizontal_ruler.add_stylebox_override("pressed", ruler_style)
|
||||
|
@ -105,7 +98,7 @@ func change_theme(id: int) -> void:
|
|||
|
||||
change_icon_colors()
|
||||
|
||||
Global.preferences_dialog.get_node("Popups/ShortcutSelector").theme = main_theme
|
||||
Global.preferences_dialog.get_node("Popups/ShortcutSelector").theme = theme
|
||||
|
||||
# Sets disabled theme color on palette swatches
|
||||
Global.palette_panel.reset_empty_palette_swatches_color()
|
||||
|
|
|
@ -362,7 +362,8 @@ func preference_update(prop: String) -> void:
|
|||
|
||||
if prop in ["icon_color_from", "custom_icon_color"]:
|
||||
if Global.icon_color_from == Global.IconColorFrom.THEME:
|
||||
Global.modulate_icon_color = themes.themes[themes.theme_index][2]
|
||||
var current_theme: Theme = themes.themes[themes.theme_index]
|
||||
Global.modulate_icon_color = current_theme.get_color("modulate_color", "Icons")
|
||||
else:
|
||||
Global.modulate_icon_color = Global.custom_icon_color
|
||||
themes.change_icon_colors()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
margin_right = 12.0
|
||||
margin_bottom = 20.0
|
||||
mouse_default_cursor_shape = 2
|
||||
toggle_mode = true
|
||||
button_mask = 7
|
||||
text = "1"
|
||||
script = ExtResource( 1 )
|
||||
|
|
Loading…
Reference in a new issue