mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Let the user change icon colors regardless of theme
This commit is contained in:
parent
12ce12a292
commit
ec1b29eb5e
|
@ -488,6 +488,15 @@ msgstr ""
|
|||
msgid "Purple"
|
||||
msgstr ""
|
||||
|
||||
msgid "Theme"
|
||||
msgstr ""
|
||||
|
||||
msgid "Icon color from:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Icon color:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Only affect selection"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ enum Direction {UP, DOWN, LEFT, RIGHT}
|
|||
enum ThemeTypes {DARK, BLUE, CARAMEL, LIGHT}
|
||||
enum TileMode {NONE, BOTH, X_AXIS, Y_AXIS}
|
||||
enum PanelLayout {AUTO, WIDESCREEN, TALLSCREEN}
|
||||
enum IconColorFrom {THEME, CUSTOM}
|
||||
# Stuff for arrowkey-based canvas movements nyaa ^.^
|
||||
const low_speed_move_rate := 150.0
|
||||
const medium_speed_move_rate := 750.0
|
||||
|
@ -47,11 +48,14 @@ var default_clear_color := Color.gray
|
|||
# Preferences
|
||||
var pressure_sensitivity_mode = PressureSensitivity.NONE
|
||||
var open_last_project := false
|
||||
var smooth_zoom := true
|
||||
|
||||
var shrink := 1.0
|
||||
var dim_on_popup := true
|
||||
var smooth_zoom := true
|
||||
var theme_type : int = ThemeTypes.DARK
|
||||
var modulate_button_color : Color = Color.gray
|
||||
var modulate_icon_color := Color.gray
|
||||
var icon_color_from : int = IconColorFrom.THEME
|
||||
var custom_icon_color := Color.gray
|
||||
|
||||
var default_image_width := 64
|
||||
var default_image_height := 64
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var theme_index := 0
|
||||
|
||||
onready var themes := [
|
||||
[preload("res://assets/themes/dark/theme.tres"), "Dark"],
|
||||
[preload("res://assets/themes/gray/theme.tres"), "Gray"],
|
||||
[preload("res://assets/themes/blue/theme.tres"), "Blue"],
|
||||
[preload("res://assets/themes/caramel/theme.tres"), "Caramel"],
|
||||
[preload("res://assets/themes/light/theme.tres"), "Light"],
|
||||
[preload("res://assets/themes/purple/theme.tres"), "Purple"],
|
||||
[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],
|
||||
]
|
||||
|
||||
onready var buttons_container : BoxContainer = $ThemeButtons
|
||||
onready var colors_container : BoxContainer = $ThemeColorsSpacer/ThemeColors
|
||||
onready var theme_color_preview_scene = preload("res://src/Preferences/ThemeColorPreview.tscn")
|
||||
|
@ -53,21 +56,20 @@ func _on_Theme_pressed(index : int) -> void:
|
|||
|
||||
func change_theme(ID : int) -> void:
|
||||
var font = Global.control.theme.default_font
|
||||
theme_index = ID
|
||||
var main_theme : Theme = themes[ID][0]
|
||||
var darkergray := Color(0.2, 0.2, 0.2)
|
||||
|
||||
if ID == 0 or ID == 1 or ID == 5: # Dark, Gray or Purple Theme
|
||||
Global.theme_type = Global.ThemeTypes.DARK
|
||||
Global.modulate_button_color = Color.gray
|
||||
elif ID == 2: # Godot's Theme
|
||||
Global.theme_type = Global.ThemeTypes.BLUE
|
||||
Global.modulate_button_color = Color.gray
|
||||
elif ID == 3: # Caramel Theme
|
||||
Global.theme_type = Global.ThemeTypes.CARAMEL
|
||||
Global.modulate_button_color = darkergray
|
||||
elif ID == 4: # Light Theme
|
||||
Global.theme_type = Global.ThemeTypes.LIGHT
|
||||
Global.modulate_button_color = darkergray
|
||||
|
||||
if Global.icon_color_from == Global.IconColorFrom.THEME:
|
||||
Global.modulate_icon_color = themes[ID][2]
|
||||
|
||||
Global.control.theme = main_theme
|
||||
Global.control.theme.default_font = font
|
||||
|
@ -93,24 +95,7 @@ func change_theme(ID : int) -> void:
|
|||
Global.vertical_ruler.add_stylebox_override("hover", ruler_style)
|
||||
Global.vertical_ruler.add_stylebox_override("focus", ruler_style)
|
||||
|
||||
for button in get_tree().get_nodes_in_group("UIButtons"):
|
||||
if button is TextureButton:
|
||||
button.modulate = Global.modulate_button_color
|
||||
if button.disabled:
|
||||
button.modulate.a = 0.5
|
||||
elif button is Button:
|
||||
var texture : TextureRect
|
||||
for child in button.get_children():
|
||||
if child is TextureRect and child.name != "Background":
|
||||
texture = child
|
||||
break
|
||||
|
||||
if texture:
|
||||
texture.modulate = Global.modulate_button_color
|
||||
if button.disabled:
|
||||
texture.modulate.a = 0.5
|
||||
elif button is TextureRect or button is Sprite:
|
||||
button.modulate = Global.modulate_button_color
|
||||
change_icon_colors()
|
||||
|
||||
# Make sure the frame text gets updated
|
||||
Global.current_project.current_frame = Global.current_project.current_frame
|
||||
|
@ -119,3 +104,24 @@ func change_theme(ID : int) -> void:
|
|||
|
||||
# Sets disabled theme color on palette swatches
|
||||
Global.palette_panel.reset_empty_palette_swatches_color()
|
||||
|
||||
|
||||
func change_icon_colors() -> void:
|
||||
for node in get_tree().get_nodes_in_group("UIButtons"):
|
||||
if node is TextureButton:
|
||||
node.modulate = Global.modulate_icon_color
|
||||
if node.disabled:
|
||||
node.modulate.a = 0.5
|
||||
elif node is Button:
|
||||
var texture : TextureRect
|
||||
for child in node.get_children():
|
||||
if child is TextureRect and child.name != "Background":
|
||||
texture = child
|
||||
break
|
||||
|
||||
if texture:
|
||||
texture.modulate = Global.modulate_icon_color
|
||||
if node.disabled:
|
||||
texture.modulate.a = 0.5
|
||||
elif node is TextureRect or node is Sprite:
|
||||
node.modulate = Global.modulate_icon_color
|
||||
|
|
|
@ -3,9 +3,12 @@ extends AcceptDialog
|
|||
# Preferences table: [Prop name in Global, relative node path, value type, default value]
|
||||
var preferences = [
|
||||
["open_last_project", "Startup/StartupContainer/OpenLastProject", "pressed", Global.open_last_project],
|
||||
|
||||
["shrink", "Interface/ShrinkContainer/ShrinkHSlider", "value", Global.shrink],
|
||||
["dim_on_popup", "Interface/DimPopup/CheckBox", "pressed", Global.dim_on_popup],
|
||||
["smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed", Global.smooth_zoom],
|
||||
["icon_color_from", "Interface/IconColorFrom/IconColorOptionButton", "selected", Global.icon_color_from],
|
||||
["custom_icon_color", "Interface/IconColorFrom/IconColorButton", "color", Global.custom_icon_color],
|
||||
|
||||
["pressure_sensitivity_mode", "Startup/PressureSentivity/PressureSensitivityOptionButton", "selected", Global.pressure_sensitivity_mode],
|
||||
["show_left_tool_icon", "Indicators/IndicatorsContainer/LeftToolIconCheckbox", "pressed", Global.show_left_tool_icon],
|
||||
["show_right_tool_icon", "Indicators/IndicatorsContainer/RightToolIconCheckbox", "pressed", Global.show_right_tool_icon],
|
||||
|
@ -18,6 +21,7 @@ var preferences = [
|
|||
["default_image_height", "Image/ImageOptions/ImageDefaultHeight", "value", Global.default_image_height],
|
||||
["default_fill_color", "Image/ImageOptions/DefaultFillColor", "color", Global.default_fill_color],
|
||||
|
||||
["smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed", Global.smooth_zoom],
|
||||
["grid_type", "Canvas/GridOptions/GridType", "selected", Global.grid_type],
|
||||
["grid_width", "Canvas/GridOptions/GridWidthValue", "value", Global.grid_width],
|
||||
["grid_height", "Canvas/GridOptions/GridHeightValue", "value", Global.grid_height],
|
||||
|
@ -52,6 +56,7 @@ onready var right_side : VBoxContainer = $HSplitContainer/ScrollContainer/VBoxCo
|
|||
onready var autosave_interval : SpinBox = $HSplitContainer/ScrollContainer/VBoxContainer/Backup/AutosaveContainer/AutosaveInterval
|
||||
onready var restore_default_button_scene = preload("res://src/Preferences/RestoreDefaultButton.tscn")
|
||||
onready var shrink_label : Label = $HSplitContainer/ScrollContainer/VBoxContainer/Interface/ShrinkContainer/ShrinkLabel
|
||||
onready var themes : BoxContainer = $"HSplitContainer/ScrollContainer/VBoxContainer/Interface/Themes"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -160,6 +165,13 @@ func preference_update(prop : String) -> void:
|
|||
Global.canvas.selection.marching_ants_outline.material.set_shader_param("second_color", Global.selection_border_color_2)
|
||||
Global.canvas.selection.update()
|
||||
|
||||
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]
|
||||
else:
|
||||
Global.modulate_icon_color = Global.custom_icon_color
|
||||
themes.change_icon_colors()
|
||||
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ text = "System Language"
|
|||
visible = false
|
||||
margin_top = 28.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 110.0
|
||||
margin_bottom = 134.0
|
||||
|
||||
[node name="ShrinkContainer" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"]
|
||||
margin_right = 498.0
|
||||
|
@ -163,13 +163,13 @@ margin_bottom = 48.0
|
|||
|
||||
[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/DimPopup"]
|
||||
margin_top = 5.0
|
||||
margin_right = 207.0
|
||||
margin_right = 193.0
|
||||
margin_bottom = 19.0
|
||||
text = "Dim interface on dialog popup"
|
||||
|
||||
[node name="CheckBox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/DimPopup"]
|
||||
margin_left = 211.0
|
||||
margin_right = 258.0
|
||||
margin_left = 197.0
|
||||
margin_right = 244.0
|
||||
margin_bottom = 24.0
|
||||
mouse_default_cursor_shape = 2
|
||||
pressed = true
|
||||
|
@ -207,6 +207,47 @@ margin_top = 4.0
|
|||
margin_bottom = 4.0
|
||||
custom_constants/separation = 12
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"]
|
||||
margin_top = 52.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 56.0
|
||||
|
||||
[node name="IconColorFrom" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface"]
|
||||
margin_top = 86.0
|
||||
margin_right = 498.0
|
||||
margin_bottom = 106.0
|
||||
columns = 3
|
||||
|
||||
[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/IconColorFrom"]
|
||||
margin_top = 3.0
|
||||
margin_right = 102.0
|
||||
margin_bottom = 17.0
|
||||
text = "Icon color from:"
|
||||
|
||||
[node name="IconColorOptionButton" type="OptionButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/IconColorFrom"]
|
||||
margin_left = 106.0
|
||||
margin_right = 179.0
|
||||
margin_bottom = 20.0
|
||||
mouse_default_cursor_shape = 2
|
||||
text = "Theme"
|
||||
items = [ "Theme", null, false, 0, null, "Custom", null, false, 1, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="Label2" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/IconColorFrom"]
|
||||
margin_top = -83.0
|
||||
margin_right = 102.0
|
||||
margin_bottom = -69.0
|
||||
text = "Icon color:"
|
||||
|
||||
[node name="IconColorButton" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Interface/IconColorFrom"]
|
||||
margin_top = 24.0
|
||||
margin_right = 64.0
|
||||
margin_bottom = 44.0
|
||||
rect_min_size = Vector2( 64, 20 )
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
color = Color( 0.75, 0.75, 0.75, 1 )
|
||||
|
||||
[node name="Canvas" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
|
||||
visible = false
|
||||
margin_top = 28.0
|
||||
|
|
|
@ -8,7 +8,7 @@ var node : Node
|
|||
|
||||
|
||||
func _ready() -> void:
|
||||
modulate = Global.modulate_button_color
|
||||
modulate = Global.modulate_icon_color
|
||||
|
||||
|
||||
func _on_RestoreDefaultButton_pressed() -> void:
|
||||
|
|
|
@ -16,9 +16,9 @@ func _ready() -> void:
|
|||
load_config()
|
||||
$PixelPerfect.pressed = tool_slot.pixel_perfect
|
||||
$Mirror/Horizontal.pressed = tool_slot.horizontal_mirror
|
||||
$Mirror/Horizontal.modulate = Global.modulate_button_color
|
||||
$Mirror/Horizontal.modulate = Global.modulate_icon_color
|
||||
$Mirror/Vertical.pressed = tool_slot.vertical_mirror
|
||||
$Mirror/Vertical.modulate = Global.modulate_button_color
|
||||
$Mirror/Vertical.modulate = Global.modulate_icon_color
|
||||
|
||||
|
||||
func _on_PixelPerfect_toggled(button_pressed : bool) -> void:
|
||||
|
|
|
@ -26,7 +26,7 @@ func _ready() -> void:
|
|||
var normal_file_name = texture.texture.resource_path.get_file()
|
||||
|
||||
texture.texture = load("res://assets/graphics/%s/%s" % [button_category, normal_file_name])
|
||||
texture.modulate = Global.modulate_button_color
|
||||
texture.modulate = Global.modulate_icon_color
|
||||
|
||||
if Global.current_project.layers[i].visible:
|
||||
Global.change_button_texturerect(visibility_button.get_child(0), "layer_visible.png")
|
||||
|
|
Loading…
Reference in a new issue