"""Second theme step: sky-blue accent -> green (Jobinex-style green-black + lime).
  blue family (hue 190-220, s >= .30)
    pale tints (l >= .86) -> pale lime tint (hue 92)
    otherwise             -> green (hue 100), 10% darker so it stays readable on white
Lime (#a3e35a) is used explicitly in dark sections, not through this mapping."""
import re,sys,colorsys
sys.path.insert(0,__file__.rsplit('/',1)[0])
import retheme_colors as rc
def conv(r,g,b):
    h,l,s=colorsys.rgb_to_hls(r/255,g/255,b/255);hd=h*360
    if s>=.30 and 190<=hd<=220:
        if l>=.86:return colorsys.hls_to_rgb(92/360,l,min(s,.7))
        return colorsys.hls_to_rgb(100/360,max(.18,l-.1),min(s,.72))
    return None
rc.conv=conv
if __name__=="__main__":
    tot=0
    for f in sys.argv[1:]:
        s=open(f,encoding='utf8').read();log=[];o=rc.run(s,log)
        if o!=s:open(f,'w',encoding='utf8').write(o)
        tot+=len(log)
    print('total',tot)
