mirror of
https://github.com/mt-mods/unifieddyes.git
synced 2024-12-01 11:53:45 +01:00
add extended palette
full 256-color range: 24 full hues, with four lighter shades and two darker shades, plus low-saturation versions of the full and darker shades, and 16 levels of greyscale
This commit is contained in:
parent
34299b01a0
commit
0ceb8f0afe
62
init.lua
62
init.lua
@ -58,6 +58,25 @@ local HUES = {
|
|||||||
"redviolet"
|
"redviolet"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local SATS = {
|
||||||
|
"",
|
||||||
|
"_s50"
|
||||||
|
}
|
||||||
|
|
||||||
|
local VALS = {
|
||||||
|
"",
|
||||||
|
"medium_",
|
||||||
|
"dark_"
|
||||||
|
}
|
||||||
|
|
||||||
|
local GREYS = {
|
||||||
|
"white",
|
||||||
|
"light_grey",
|
||||||
|
"grey",
|
||||||
|
"dark_grey",
|
||||||
|
"black"
|
||||||
|
}
|
||||||
|
|
||||||
local HUES2 = {
|
local HUES2 = {
|
||||||
"Red",
|
"Red",
|
||||||
"Orange",
|
"Orange",
|
||||||
@ -91,6 +110,27 @@ local default_dyes = {
|
|||||||
"yellow"
|
"yellow"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- this tiles the "extended" palette sideways and then crops it to 256x1
|
||||||
|
-- to convert it from human readable to something the engine can use as a palette.
|
||||||
|
--
|
||||||
|
-- in machine-readable form, the selected color is:
|
||||||
|
-- 16 + [hue] - [shade]*24 for the light colors, or
|
||||||
|
-- 16 + [hue] + [saturation]*24 + [shade]*48 for the dark colors, or
|
||||||
|
-- [shade] (no math) for the greys, 0 = white.
|
||||||
|
|
||||||
|
unifieddyes.extended_palette = "[combine:256x1"
|
||||||
|
..":0,0=unifieddyes_palette_extended.png"
|
||||||
|
..":16,-1=unifieddyes_palette_extended.png"
|
||||||
|
..":40,-2=unifieddyes_palette_extended.png"
|
||||||
|
..":64,-3=unifieddyes_palette_extended.png"
|
||||||
|
..":88,-4=unifieddyes_palette_extended.png"
|
||||||
|
..":112,-5=unifieddyes_palette_extended.png"
|
||||||
|
..":136,-6=unifieddyes_palette_extended.png"
|
||||||
|
..":160,-7=unifieddyes_palette_extended.png"
|
||||||
|
..":184,-8=unifieddyes_palette_extended.png"
|
||||||
|
..":208,-9=unifieddyes_palette_extended.png"
|
||||||
|
..":232,-10=unifieddyes_palette_extended.png"
|
||||||
|
|
||||||
-- code borrowed from homedecor
|
-- code borrowed from homedecor
|
||||||
|
|
||||||
-- call this function to reset the rotation of a "wallmounted" object on place
|
-- call this function to reset the rotation of a "wallmounted" object on place
|
||||||
@ -495,6 +535,28 @@ for _, color in ipairs(default_dyes) do
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- build a table to convert from classic/89-color palette to extended palette
|
||||||
|
|
||||||
|
unifieddyes.convert_classic_palette = {}
|
||||||
|
|
||||||
|
for hue = 0, 11 do
|
||||||
|
-- light
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx("dye:light_"..HUES[hue+1], false)
|
||||||
|
unifieddyes.convert_classic_palette[paletteidx] = 16 + hue*2 + 48
|
||||||
|
for sat = 0, 1 do
|
||||||
|
for val = 0, 2 do
|
||||||
|
-- full
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx("dye:"..VALS[val+1]..HUES[hue+1]..SATS[sat+1], false)
|
||||||
|
unifieddyes.convert_classic_palette[paletteidx] = 16 + hue*2 + sat*24 + (val+4)*48
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for grey = 0, 4 do
|
||||||
|
local paletteidx = unifieddyes.getpaletteidx("dye:"..GREYS[grey+1], false)
|
||||||
|
unifieddyes.convert_classic_palette[paletteidx] = grey
|
||||||
|
end
|
||||||
|
|
||||||
-- Items/recipes needed to generate the few base colors that are not
|
-- Items/recipes needed to generate the few base colors that are not
|
||||||
-- provided by the standard dyes mod.
|
-- provided by the standard dyes mod.
|
||||||
|
|
||||||
|
BIN
textures/unifieddyes_palette_extended.png
Normal file
BIN
textures/unifieddyes_palette_extended.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 299 B |
Loading…
Reference in New Issue
Block a user