Going by here: https://wiki.factorio.com/Tutorial:Mod_ ... e_property
We have types bool, int, double and string... which is good for many things, but...
What if I want to allow players to choose their own colour codes? currently, I'd have to have 3 values for the Red, Green and Blue components of each colour and combine them in my code... or give them pre-defined options using the string type option, depending how user friendly, or customisable you feel like being.
It would be nice to have a color code option with an RGB colour picker GUI in the mod settings menu... or HSL too, I know many people have been asking for that for things that can already have the colour customised in game, like the Locomotive.
Mod settings, colour code type
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
- LuziferSenpai
- Filter Inserter
- Posts: 333
- Joined: Tue Jul 08, 2014 10:06 am
- Contact:
Re: Mod settings, colour code type
bobingabout wrote: ↑Sat May 02, 2020 9:43 pmGoing by here: https://wiki.factorio.com/Tutorial:Mod_ ... e_property
We have types bool, int, double and string... which is good for many things, but...
What if I want to allow players to choose their own colour codes? currently, I'd have to have 3 values for the Red, Green and Blue components of each colour and combine them in my code... or give them pre-defined options using the string type option, depending how user friendly, or customisable you feel like being.
It would be nice to have a color code option with an RGB colour picker GUI in the mod settings menu... or HSL too, I know many people have been asking for that for things that can already have the colour customised in game, like the Locomotive.
Code: Select all
if text:sub( 1, 1 ) == "#" and text:len() == 7 then
for i = 2, 7 do
if not text:sub( i, i ):find( "%x" ) then
ColorUpdate( player_id, "" )
return
end
end
Code: Select all
local HEXtoColor = function( HEX )
HEX = HEX:gsub( "#", "" )
return { r = tonumber( "0x" .. HEX:sub( 1, 2 ) ), g = tonumber( "0x" .. HEX:sub( 3, 4 ) ), b = tonumber( "0x" .. HEX:sub( 5, 6 ) ) }
end
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Mod settings, colour code type
First off, I know you're trying to help, thank you for that, but it isn't necessary.LuziferSenpai wrote: ↑Sun May 03, 2020 10:44 ambobingabout wrote: ↑Sat May 02, 2020 9:43 pmGoing by here: https://wiki.factorio.com/Tutorial:Mod_ ... e_property
We have types bool, int, double and string... which is good for many things, but...
What if I want to allow players to choose their own colour codes? currently, I'd have to have 3 values for the Red, Green and Blue components of each colour and combine them in my code... or give them pre-defined options using the string type option, depending how user friendly, or customisable you feel like being.
It would be nice to have a color code option with an RGB colour picker GUI in the mod settings menu... or HSL too, I know many people have been asking for that for things that can already have the colour customised in game, like the Locomotive.This Code makes sure the string it gets supplied is a hex code, then you can convert that hexcode to a color code via:Code: Select all
if text:sub( 1, 1 ) == "#" and text:len() == 7 then for i = 2, 7 do if not text:sub( i, i ):find( "%x" ) then ColorUpdate( player_id, "" ) return end end
Code: Select all
local HEXtoColor = function( HEX ) HEX = HEX:gsub( "#", "" ) return { r = tonumber( "0x" .. HEX:sub( 1, 2 ) ), g = tonumber( "0x" .. HEX:sub( 3, 4 ) ), b = tonumber( "0x" .. HEX:sub( 5, 6 ) ) } end
The purpose of me writing this request is to try and make mods as user friendly as possible to the widest player base, by requesting game engine changes to make that easier. (The kind of thing I'd probably try and write myself if I still had source access)
I said "depending how user friendly, or customisable you feel like being"
Average Joe probably doesn't even know what a colour code is, heck, writing a colour as a 6 digit hexadecimal hash isn't all that intuitive to me, even though I know why it's written like that, which is one reason why people are asking for HSL options (Even though they might not know what "Hue" means, It's more intuitive for people who don't know the ins and outs of computers) and colour pickers.
And part of the reason why I was asking for this as a distinct settings option was to allow the colour picking GUI to show up in the settings screen(I know from experience that if a GUI or GUI element exists, it's often trivial to just re-use it elsewhere), make it as clear to the player as possible that you want a colour here, and as easy as possible for them to pick one.
Re: Mod settings, colour code type
To add to this, a great usability improvement would be if the game's color pickers were HSV instead of RGB. HSV is much more intuitive to use and makes it much easier to get the desired color.
Don't forget, you're here forever.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Mod settings, colour code type
I did actually mention that in my suggestion, though, I'd have to opt between a user toggle, so RGB can still be used. a Tickbox or something.
Re: Mod settings, colour code type
Sometimes I can read, but apparently yesterday was not one of those days.bobingabout wrote: ↑Thu May 14, 2020 6:00 pmI did actually mention that in my suggestion, though, I'd have to opt between a user toggle, so RGB can still be used. a Tickbox or something.
Yes, being able to switch between them would also be nice. Maximum flexibility!
Edit: I would prefer HSV instead of HSL, as (at least for me), it's a bit more intutive.
Don't forget, you're here forever.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Mod settings, colour code type
One or the other, I'd be happy with either.Raiguard wrote: ↑Thu May 14, 2020 7:35 pmSometimes I can read, but apparently yesterday was not one of those days.bobingabout wrote: ↑Thu May 14, 2020 6:00 pmI did actually mention that in my suggestion, though, I'd have to opt between a user toggle, so RGB can still be used. a Tickbox or something.
Yes, being able to switch between them would also be nice. Maximum flexibility!
Edit: I would prefer HSV instead of HSL, as (at least for me), it's a bit more intutive.
I can't even remember which way around it is, but one of them has saturation go between colour and black, then the lightness scale goes from colour(or black if you maxed that slider) to white, while the other one, saturation goes from colour to grey, then lightness scale goes from black, to colour in the middle, and white on the other end, which is basically just black to white if your colour is grey.
The more intuitive one for me is the one where the saturation slider goes to black, and the other goes to white. (But I've never seen it in an art program)
EDIT:
Apparantly, HSV, Saturation goes from White to Colour and Value goes from Black to Colour, so, we both have a preference for HSV