@@ -163,11 +163,18 @@ return { hue = hue, saturation = saturation, luminosity = luminosity } end; readable = function(self, target) - target = target or 0.5 + target = target or 0.6 local hsl = self:to_hsl() hsl.luminosity = target + local worstHue = 230 + local nearness = math.abs(worstHue - hsl.hue) + if nearness <= 70 then + local boost = 1.0 - (nearness / 70) + hsl.luminosity = math.min(1, hsl.luminosity * (1 + (boost*0.4))) + end + return from_hsl(hsl, self.alpha) end; bg = function(self, text) return @@ -184,9 +191,10 @@ local hsl = self:to_hsl() -- Do the calculation, clamp to 0-1 instead of the clamp fn hsl.luminosity = math.min(math.max(hsl.luminosity * fac, 0), 1) -- Turn back into RGB color - local t = from_hsl(hsl, self.alpha) + -- local t = from_hsl(hsl, self.alpha) + -- print("darker is r"..hsl.red.."g"..hsl.green.."b"..hsl.blue) -- print("brighten is r"..t.red.."g"..t.green.."b"..t.blue) return from_hsl(hsl, self.alpha) end;