Changing gui background colors?
-
- Inserter
- Posts: 30
- Joined: Fri Jun 14, 2024 12:33 am
- Contact:
Changing gui background colors?
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.
Re: Changing gui background colors?
This needs to be done by defining gui styles at data stage https://lua-api.factorio.com/latest/pro ... Style.html
-
- Inserter
- Posts: 30
- Joined: Fri Jun 14, 2024 12:33 am
- Contact:
Re: Changing gui background colors?
Since the style prototype is limited to one total instance, how do i extend that?
Unless I'm just blind, also appears that most of the data-stage style specifications don't have background colors either.
Unless I'm just blind, also appears that most of the data-stage style specifications don't have background colors either.
Re: Changing gui background colors?
It’s not a specific color code in the style, but part of the image set used by the style - in the PNG.
If you want to get ahold of me I'm almost always on Discord.
-
- Inserter
- Posts: 30
- Joined: Fri Jun 14, 2024 12:33 am
- Contact:
Re: Changing gui background colors?
That's using ElementImageSetLayer?
I'll probably be able to understand that once i'm sober.
How do i add my new styles to the existing GUI style instance?
I'll probably be able to understand that once i'm sober.
How do i add my new styles to the existing GUI style instance?
Re: Changing gui background colors?
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})
With GUI-styles, this doesn't work. The only style that will be used is data.raw['gui-style'].default. However, you can add new styles to that! You don't even have to create everything from scratch, just pass on a 'parent' and all properties you don't set directly will be inherited. This is how I've defined styles in Autodrive:
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

A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!