Coder Social home page Coder Social logo

jonasjacek / colors Goto Github PK

View Code? Open in Web Editor NEW
85.0 5.0 22.0 162 KB

List of 256 color codes for Xterm including an example of the color, Xterm Name, Xterm Number, HEX, RGB and HSL code.

Home Page: https://www.ditig.com/publications/256-colors-cheat-sheet

License: Creative Commons Attribution Share Alike 4.0 International

HTML 100.00%
xterm color colors xterm-number xterm-name 256-colors color-codes cheatsheet cheat-sheets terminal

colors's People

Contributors

dom111 avatar jonasjacek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

colors's Issues

Duplicate color names.

I don't know whether it's ANSI's standard names or not, but I'd like to know where did you get those names from. I been searching the internet for ANSI's official color names for their 256 color palette, and have found none.

"Xterm Names" are inaccurate

The colors in xterm's 256color palette are not named. This means that arbitrarily assigning them names pulled from another palette, /usr/lib/X11/rgb.txt in this case, and listing those names under "Xterm Name" is highly misleading.

Moreover, the colors that are, in fact, based on X11 colors by default, 0 to 15, are associated to the wrong X11 color names.

I would suggest either renaming the column with a more straightforward name like "Name Of The Closest X11 Color" or removing the column altogether.

Maroon / Red (#1) is incorrect

Hello,

I don't know if I'm missing something, but if I reset xterm to default configuration and display the red color (echo -ne \e[41m ) it get's displayed as RGB(204, 0, 0) that is #cc0000. The table claims RGB(128, 0, 0) which would be #800000.

I couldn't find this anywhere in the Wikipedia article either.

Have a great day

Reworked the Table

Hi, thanks for the table.

As you say there are clashes and so I reworked it.

Sorted / renamed those often conflicting names using your luminance infos into descending order regarding brightness.

image

Btw: How did you calculate those hsl values, sometimes they look a bit off, visually...

Anyway, source for the fix:

colors = <paste your json table here>

if __name__ == "__main__":

    # first remove all numbers from the names, they don't fit:
    names = {}
    for m in colors:
        n = m["name"]
        while n[-1].isdigit():
            n = n[:-1]
        m["name"] = n
        names.setdefault(n, []).append(m)
    # we nave now in names:
    # {'Red': [{'name': 'Red', id: 9, ..., hsl: }, {'name': 'Red', id:196, ...}..

    # first Red is not red:
    red = names["Red"].pop(0)
    red["name"] = "Salmon"
    names["Salmon"].append(red)

    # now sort the lists per luminance and set the numbers from high to low lum.:
    nn = {}
    for n, ms in names.items():
        if len(ms) > 1:
            ms = sorted(
                ms,
                key=lambda k: 10000
                - float("%s.%s" % (k["hsl"]["l"], int(k["hsl"]["h"]))),
            )
        # first greys are actually darker whites, so:
        if n == "Grey":
            ws, ms = ms[:3], ms[3:]
            i = 1
            for w in ws:
                wn = "White%s" % i
                nn[wn] = w
                i += 1
        i = ""
        for m in ms:
            # DarkOlive makes no sense, superbright first - and there is no Olive:
            na = (m["name"] + str(i)).replace("DarkOlive", "Olive")
            m["name"] = na
            i = 1 if not i else i + 1
            nn[na] = m

    names = nn
    table = {}
    for n, m in names.items():
        table[m["colorId"]] = m

    import sys, json

    sys.argv.append("")
    if sys.argv[1] == "table":
        print(json.dumps(table, sort_keys=1))
    elif sys.argv[1] == "names":
        print(json.dumps(names, sort_keys=1))
    else:
        tm = "%(colorId)4s \x1b[38;5;%(colorId)sm%(name)s\x1b[0m"
        for n, m in names.items():
            print(tm % m)

Then save this as foo.py and run python3 foo.py [table|names]

If you say python3 foo.py names | jq . you get

image

source?

How did you get all of the colors names and values?

Otherwise thank you, this will be useful to me.

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.