Changing gui background colors?
Posted: Thu Aug 14, 2025 5:25 am
How do i change the background colors of GUI elements like buttons or flows and panes? It doesn't look like that exists as part of luastyle.
With other prototypes, you'd use something likescruffyvoltherder wrote: Sat Aug 16, 2025 5:07 am How do i add my new styles to the existing GUI style instance?
Code: Select all
local new_proto = table.deepcopy(data.raw[old_type][old_name])
new_proto.name = new_name
...
data:extend({new_proto})
Code: Select all
local styles = {}
-- Define button styles
styles.autodrive_button_off = {
type = "button_style",
parent = "shortcut_bar_button",
padding = 4,
}
styles.autodrive_button_on = {
type = "button_style",
parent = "shortcut_bar_button_green",
padding = 4,
}
-- Define textfield styles
styles.AD_highlighted_value_textfield = {
type = "textbox_style",
parent = "highlighted_value_textfield",
font = "default",
font_color = {},
}
styles.AD_stretchable_textfield = {
type = "textbox_style",
parent = "stretchable_textfield",
disabled_font = "default-bold",
disabled_font_color = {1, 1, 1, 1},
}
styles.AD_inner_frame = {
type = "frame_style",
parent = "inside_shallow_frame_with_padding",
vertically_stretchable = "on",
horizontal_align = "center",
vertical_align = "center",
}
-- Create styles
for s_name, s_data in pairs(styles) do
data.raw['gui-style'].default[s_name] = s_data
end