Giter Club home page Giter Club logo

rgbto256's Introduction

rgbto256

Not all terminals support 24-bit true color—others support only 256 colors, so a conversion must take place. However, when converting from true color to 256, most programs assume that the RGB axes are orthogonal and simply use the Euclidean distance to find the “closest” available color, which produces slightly inaccurate results.

rgbto256 accepts true color input and more accurately converts it to 256 colors using the CIEDE2000 algorithm.

Example

cat misc/example

In a terminal that supports true color, this produces the following:

original image

In a terminal that converts to 256 colors (using a simple Euclidean distance calculation), we get this instead:

usual 256 color conversion

However, when piped through rgbto256, the colors are closer to the original image:

cat misc/example | ./utils/rgbto256

result when run through rgbto256

Building

Make and GCC must be installed. Then simply run make.

Usage

./utils/rgbto256 reads data from standard input and echoes it to standard output, except with true color ANSI escape sequences converted to 256 colors.

For example:

cat misc/example | ./utils/rgbto256

License

rgbto256 is licensed under version 3 of the GNU Affero General Public License, or (at your option) any later version. See LICENSE.

Contributing

By contributing to rgbto256, you agree that your contribution may be used according to the terms of rgbto256’s license.

rgbto256's People

Contributors

taylordotfish avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.