Comments (3)
I may be able to help out here:
@ymattw Can you point out in the code where the colors are set?
The color definition is not exactly hard to find if you try just a little bit:
Lines 43 to 60 in ce8f7a1
These are ANSI escape codes, and are sort of the least common denominator for encoding colors across terminal applications.
ydiff uses the 3/4bit ones, which essentially mean there are 16 basic named colors (in order: black, red, green, yellow, blue, magenta, cyan, white; and their respective bright- variants), which exact RGB-value is set by your terminal. So if you just wanted a lighter/darker shade of red, adjust your terminal accordingly. If you wanted magenta/cyan instead of red/green, you would just change the ANSI escape code in that color-definition above.
There are two other modes: 8bit (256 colors) and 24bit (full RGB, 32M colors). Many terminal today do have "truecolor" support, but some don't and never will (basic xterm has not, for example).
And doing truecolor-support the right way is hard. For your "simple" suggestion, you'd have to have to do:
- a custom config file for ydiff
- a custom DSL for defining colors, either as 4bit, 8bit or 24bit ones (RGB,RGB-A,HSV,…?)
- parsing of this color-DSL and generating the appropriate ANSI escape codes. Sure there are probably libraries for that, but that's another dependency.
- check if the terminal you're outputting to does support 256/24bit colors or not, and add fallbacks. This is the hardest step, because there currently is just no reliable way to do that. You can find a great writeup here: https://gist.github.com/XVilka/8346728
All in all probably too much hassle for a tool that just displays two colors.
from ydiff.
Unfortunately I do not have plan to support that. I intentionally want to keep the tool simple enough. But I can imagine there are different flavors of color schema, so I am open to accept contribution :).
from ydiff.
@ymattw Can you point out in the code where the colors are set?
This could easily be done by having a config file that ydiff
reads from, but for any configuration settings not set, or if the config file is missing entirely, it will just use some defaults. That's what I would do.
from ydiff.
Related Issues (20)
- How to use ydiff in "git add -p"? HOT 2
- Request: expose basic diff command as a callable HOT 4
- Unable to diff two local files? HOT 2
- Highlight just changed characters, not lines.
- Apt package? HOT 2
- side-by-side becomes unified when disabling color HOT 7
- Using "git difftool --extcmd="ydiff" displayes temporary file names HOT 3
- Hang on large files HOT 5
- Replace legacy distutils by... setuptools? HOT 7
- Implement option to ignore deleted files HOT 7
- " brew install ydiff " doesnt work HOT 2
- Fedora package HOT 6
- Configurable pager behaviour (auto/always/never) HOT 13
- Heads-up: FreeBSD package
- configure default to side by side HOT 4
- Stdin only works if in a VCS HOT 1
- Tabs are not expanded correctly in `-s` mode
- How to use on Windows HOT 4
- Highlight changes instead of underlining them HOT 2
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 ydiff.