Comments (12)
Chatted on Slack with @plexus about this one. Summary:
- Go ahead with some mockups so we can get a feel for what this might look like
- Bear in mind that some people will not like the change, so in addition to any new coloring we'll still need to support the current coloring through some sort of config (analysis to come if we decide to proceed) - default would very likely be current coloring.
from deep-diff2.
Ok, I played around with some mockups.
Everybody likely has different terminal color schemes and fonts setup. I did my testing on macOS using iTerm2 using the "Roboto Mono for Powerline" font with the "Solarized Dark" color preset for for dark background testing and "Solarized Light" for light background testing. Note that the Solarized themes do compensate for yellow looking terrible on a light background.
README screenshot
Here is the example presented on the deep-diff README...
It looks like whoever took this screenshot was using a similar terminal color scheme similar to the one I am using for my tests.
Option A) baseline
If I run README example against current code, I get:
This closely matches the README screenshot.
I won't explore it more unless requested, but if a terminal color scheme is chosen that does not compensate for yellow, you'll see something like this on a light background:
Option B) Option A + blue delimiter characters
To me, this maybe a bit better, my eye is drawn to the red of the change.
Option C) Option A + background colors for insertions/deletions
Ok. no.
Option D) Option C + with black foreground for insertions/deletions
To me, this is great, I see my insertions and deletions clearly.
Option E) Option D + Option B
And one last variation that combines option B and D
To me, Option E is slightly better than Option D as the distracting red is gone.
Let's see what this candidate looks like on a light background:
Looks good to me.
I will follow up with another message exploring how this looks with a larger diff.
from deep-diff2.
Where coloring changes really shine are for larger diffs. Let's compare the current highlighting of a larger diff to Option E highlighting.
from deep-diff2.
I'd be curious if puget allows rgb colors, so we can come up with a sensible scheme that isn't dependent on people's terminal configuration.
from deep-diff2.
Good question, it looks like puget might support 8-bit colors via :fg-256
and :bg-256
https://github.com/greglook/puget/blob/d438931f35454cd2eb5afc10f458ae54dfcb4285/src/puget/color/ansi.clj#L28
I’ll try them out.
from deep-diff2.
Hiya @plexus, this git issue is more interesting than I originally thought it would be!
I am thinking ANSI RGB colors might not be a great idea for one solid reason and one subjective one.
solid reason: circleci does not seem render them
I found a few scripts that test out terminal capabilities with regards to color.
Here's output from color-spaces.pl
on macOS iTerm2:
And here's the output from the same script when viewed from circleci's web interface:
subjective reason: 16-color ANSI option is themable
Maybe it is not important for all people who use kaocha to see the very same colors. People choose color themes in their terminals to get consistent coloring across all 16-color ANSI terminal apps they use. Like you said red and green have specific meanings, but maybe I like my red to be rust and you like yours to be indigo. Consistent terminal colors with 16-ANSI-color Vim themes gives a good overview of the concept.
I think this also puts configuration of color to address any accessibility issues with vision in the right place.
options
I see our options as:
- do nothing, solve through #13
- add an option to allow kaocha users to change the color palette to whatever puget compatible colors they like. This might include defining and selecting color themes.
- add an option to allow kaocha users to invert the color for differences only.
All I really need to address my issue is to have an option to invert colors for differences. Circleci does seem to render background colors just fine:
So I am leaning toward option 3, but I am looking forward to learning what you think.
from deep-diff2.
I'll just add a little point here: Allowing configurability to this, will let color blind people (red/green for me) to use colors that are more noticably different for them.
from deep-diff2.
Thanks @magnars, your input is much appreciated.
I have been focusing on the terminal and its typical configurability with regards to color, (or lack thereof when presented by circleci), but there is also REPL output when used from an editor and maybe other scenarios I have not thought of.
from deep-diff2.
I would still be a fan of 2., making it configurable. I also prefer rbg colors over the 16 terminal colors because they are absolute. We can set a foreground and background and be sure it renders the same everywhere. There is such a wide range of color schemes out there that whatever we do will be unreadable for some.
If it's configurable at the deep-diff level then kaocha can always detect that CI=true
and switch to something more basic.
@magnars that is a really great point. It's very unfortunate that the two colors that are so commonly used culturally to denote some kind of contrast (red/green) are also the most common colors that colorblind people have trouble with. what other colors would you use to convey added/deleted that aren't so problematic?
from deep-diff2.
from deep-diff2.
Thanks for the reply @plexus!
I still think there is strong merit to a 16 color palette being themeable.
That said, option 2 does not prohibit using the 16 color palette for those that see the benefit. I’ll proceed with testing out support for RGB colors with puget.
from deep-diff2.
I was poking around a bit with puget. I confirm that it does support 8-bit and 24-bit ANSI schemes via:fg-256
and :bg-256
.
8-bit scheme is expressed via [:fg-256 5 n]
where n is between 0 and 255. We can combine foreground and background, for example, like so: [:fg-256 5 226 :bg-256 5 56]
.
24-bit scheme is expressed via [:fg-256 2 r g b]
where r
g
b
are each between 0 and 255. Foreground and background can be combined, for example: [:fg-256 2 205 236 255 :bg-256 2 110 22 188]
.
These all show nicely in iTerm2 on macOS. They did not, however, show properly in a cider repl session in spacemacs. Caveats on 8-bit and 24-bit scheme support would be included kaocha docs.
from deep-diff2.
Related Issues (20)
- round-trip error with ###NaN HOT 4
- Print java.time.Instant as #inst HOT 6
- How to skip printing values same in both structures? HOT 10
- Closure compilation failed HOT 4
- Extract cljs port of puget
- Fall back to the system printer
- ddiff not terminating HOT 7
- Output could use ordered collections to keep it consistently ordered with input HOT 4
- Cljdoc analysis is failing HOT 5
- Round-trip error
- Fails with records with deleted keys
- Show diff at deeper level (Sets) HOT 4
- test issue for action
- Parameterize color schemes HOT 7
- Improve set handling HOT 3
- Hashmap key order shouldn't matter HOT 2
- Print string-based diff if there's a mismatch of two strings HOT 3
- Prettyprinted diff mangled when using advanced compilation in cljs HOT 6
- `#uuid` and `#inst` printing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deep-diff2.