Re: dark theme

andrew strain <[email protected]> Wed, 10 May 2023 15:05:09 -0700 (PDT)
Newsgroups gmane.editors.scite.general
Message-ID <[email protected]>
Neil : 
I think I have improved the effect of the function a bit more. Comments, 
style and some small formula improvements. cmath is avoided and abs removed 
so it could be a C++17 constexpr now.
It is calibrated to produce fully back background from full white and vice 
versa.
Very dark values of dark backgrounds are 'dragged' a little lighter to 
raise them a bit
without gamma adjustment. 
https://gist.github.com/strainer/ca20642e9a091634f685915bd6b90e51
- Andrew
On Tuesday, 9 May 2023 at 01:54:13 UTC+1 andrew strain wrote:

> Neil:
> I can certainly remove the abs, and make the loop terminate more plainly, 
> and improve the readability significantly I think. If avoiding abs or cmath 
> like Math.pow, it is tempting to tweak the brightness 'flipping' to make it 
> flip not around 50% but around 45% or 55% . That would be an approximate 
> replacement for doing gamma correction in and out. Improvement would be 
> very subtle but it only take an extra line or two. I can make a little 
> project of making it much more readable.
>
> An option is to have properties like this to expose finer control of the 
> transform.
> #rendering.transform.luminosity= -50 to 50
> #rendering.transform.saturation= 0 to 100
> #rendering.transform.brightness=-50 to 50
>
> Or those configurables are just hard coded in the formula.
> I think the optimal 'darkmode' transform for a white backed theme, would 
> not actually produce a black background from a white input, instead a white 
> -> dark charcoal, and black -> almost white. Constricting the target 
> luminosity of the output like that, lets very dark or light colors reach 
> their target with more color preserved. eg an input blue can be as dark as 
> red or brown, but they cannot invert to an equally bright red or yellow, so 
> dark blue wants to become white-ish, it loses alot of blueness to invert to 
> equal standing with greens and yellows. Restricting the output helps, and 
> over a very dark background, full white is not needed, the brightest grey 
> on the screen becomes white. Most human made dark themes use dark grey, 
> rarely black. A few folks might be perturbed if the dark mode wont produce 
> pure black though.
>
> I link below the reset for styles which I think dark mode will need 
> explicit in properties. They are taken from my custom theme which is dark, 
> but they are inverted to fit the default white backed theme. 
>
> https://gist.github.com/strainer/471ec624053923bd37a1829423d2e264
>
> It seems caret, selection highlighting and fold margin colours will need 
> programmed to transform.
>
> - Andrew
> On Tuesday, 9 May 2023 at 01:00:43 UTC+1 Neil Hodgson wrote:
>
>> Andrew: 
>>
>> > It is also remarkable how Scite can so snappily refresh the theme when 
>> my lua script rewrites the properties. 
>>
>> There's an ongoing war between 'teh snappy' and expressiveness of 
>> properties files. 
>>
>> > The results of the simple formula was a bit lack luster on the perl 
>> theme but even it would be a relief to users with visual difficulties. I 
>> dug out my pre-lua function that was patched in for conversion and I think 
>> it can do better. It is an odd blob of code but works well to demonstrate. 
>> > 
>> > https://gist.github.com/strainer/ca20642e9a091634f685915bd6b90e51 
>>
>> That's a complex calculation. The results look much better than the 
>> simple formula. I hope the loop always terminates as that's not obvious to 
>> me. 
>>
>> The function can't be marked constexpr (potentially calculated at compile 
>> time) as abs is called and abs isn't defined as constexpr in the C++ 
>> standard until C++23 although some implementations may be constexpr. SciTE 
>> still has to support C++17. 
>>
>> Neil 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/scite-interest/a0edfd0b-4221-4cb1-8f16-bd0caa85f25dn%40googlegroups.com.