Use vars for histogram colors

This commit is contained in:
Wuzzy 2022-04-20 16:50:35 +02:00
parent 77645e6667
commit f6449f2235

View File

@ -43,6 +43,10 @@ local AUTOBUILD_CHUNKDIST = 2
local FORMSPEC_BOX_COLOR = "#00000080"
-- Color for the section titles in the formspec
local FORMSPEC_HEADER_COLOR = "#000000FF"
-- Color of the diagram lines of the histogram
local FORMSPEC_HISTOGRAM_LINE_COLOR = "#FFFFFF80"
-- Color of hisogram bars
local FORMSPEC_HISTOGRAM_BAR_COLOR = "#00FF00FF"
-- Number of data buckets to use for the histogram
local HISTOGRAM_BUCKETS = 10
@ -936,9 +940,9 @@ local show_histogram_formspec = function(player, options, stats)
"label[1.1,8.15;"..F(S("Noise values")).."]"..
"label[0,7.0;"..F(S("Max.")).."\n"..F(S("Min.")).."]"..
"tooltip[0,6.8;0.7,1;"..F(S("Upper bounds (exclusive) and lower bounds (inclusive) of the noise value data bucketing")).."]"..
"box[0.75,0;0.025,8.3;#FFFFFF80]"..
"box[0,6.65;"..HISTOGRAM_BUCKETS..",0.025;#FFFFFF80]"..
"box[0,7.8;"..HISTOGRAM_BUCKETS..",0.025;#FFFFFF80]"
"box[0.75,0;0.025,8.3;"..FORMSPEC_HISTOGRAM_LINE_COLOR.."]"..
"box[0,6.65;"..HISTOGRAM_BUCKETS..",0.025;"..FORMSPEC_HISTOGRAM_LINE_COLOR.."]"..
"box[0,7.8;"..HISTOGRAM_BUCKETS..",0.025;"..FORMSPEC_HISTOGRAM_LINE_COLOR.."]"
local hstart = 1
-- Special case: If bucket sizes are equal, only show the last bucket
-- (can happen if scale=0)
@ -964,7 +968,7 @@ local show_histogram_formspec = function(player, options, stats)
local coords = x..","..maxh-bar_height..";0.8,"..bar_height
local box = ""
if count > 0 then
box = box .. "box["..coords..";#00FF00FF]"
box = box .. "box["..coords..";"..FORMSPEC_HISTOGRAM_BAR_COLOR.."]"
box = box .. "tooltip["..coords..";"..count.."]"
end
box = box .. "label["..x..",6.4;"..F(S("@1%", perc_f)).."]"