All Projects → magarcia → python-x256

magarcia / python-x256

Licence: MIT license
Find the nearest xterm 256 color index for an RGB.

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to python-x256

wcwidth-icons
Support fonts with double-width icons in xterm/rxvt-unicode/zsh/vim/…
Stars: ✭ 36 (+63.64%)
Mutual labels:  xterm
Termination
Integrated terminal for Atom. Looks like terminal-plus, acts like your native terminal (except every other Friday). Looking for collaborators! :-)
Stars: ✭ 83 (+277.27%)
Mutual labels:  xterm
Aminal
🌘 Darktile is a GPU rendered terminal emulator designed for tiling window managers.
Stars: ✭ 2,663 (+12004.55%)
Mutual labels:  xterm
Offensive-Reverse-Shell-Cheat-Sheet
Offensive Reverse Shell (Cheat Sheet)
Stars: ✭ 138 (+527.27%)
Mutual labels:  xterm
darktile
🌘 Darktile is a GPU rendered terminal emulator designed for tiling window managers.
Stars: ✭ 2,694 (+12145.45%)
Mutual labels:  xterm
ng-terminal
NgTerminal is a terminal component on Angular 12. the Ivy distribution's released from v5.0.0.
Stars: ✭ 87 (+295.45%)
Mutual labels:  xterm
go-rainbow
Golang Helper for beautiful CLI Applications
Stars: ✭ 86 (+290.91%)
Mutual labels:  xterm
django-webssh
django + django_channles 实现的 webssh
Stars: ✭ 71 (+222.73%)
Mutual labels:  xterm
xm2cloud term
powerful webssh that developed with django, channels, xterm,ioloop
Stars: ✭ 17 (-22.73%)
Mutual labels:  xterm
Xterm.js
A terminal for the web
Stars: ✭ 12,019 (+54531.82%)
Mutual labels:  xterm
blessed-xterm
XTerm Widget for Blessed Curses Environment
Stars: ✭ 37 (+68.18%)
Mutual labels:  xterm
contour
Modern C++ Terminal Emulator
Stars: ✭ 761 (+3359.09%)
Mutual labels:  xterm
Wetty
Terminal in browser over http/https. (Ajaxterm/Anyterm alternative, but much better)
Stars: ✭ 3,076 (+13881.82%)
Mutual labels:  xterm
twilight-commander
A simple console file manager.
Stars: ✭ 16 (-27.27%)
Mutual labels:  xterm
Lsix
Like "ls", but for images. Shows thumbnails in terminal using sixel graphics.
Stars: ✭ 2,635 (+11877.27%)
Mutual labels:  xterm
tempus-themes
[Mirror] Tempus is a collection of themes for Vim, text editors, and terminal emulators that are compliant at the very least with the WCAG AA accessibility standard for colour contrast
Stars: ✭ 48 (+118.18%)
Mutual labels:  xterm
local-echo
A local-echo controller for xterm.js
Stars: ✭ 96 (+336.36%)
Mutual labels:  xterm
godot-xterm
Terminal emulator for the Godot game engine.
Stars: ✭ 61 (+177.27%)
Mutual labels:  xterm
sshbg
Change terminal background when SSH'ing (on specific terminals)
Stars: ✭ 45 (+104.55%)
Mutual labels:  xterm
Ttyd
Share your terminal over the web
Stars: ✭ 4,030 (+18218.18%)
Mutual labels:  xterm

x256 Tests Code Analysis PyPI version

This is a python version from node-x256

Return the nearest xterm 256 color code for rgb inputs.

Example

You can just print the index:

from x256 import x256
ix = x256.from_rgb(220, 40, 150)
print ix # 162

or you can use raw ansi escape codes:

from x256 import x256
ix = x256.from_rgb(220, 40, 150)
print '\x1b[38;5;' + str(ix) + 'mBEEEEEP'

output:

x256 raw beep

Methods

x256.from_rgb(red, green, blue)

Return the nearest xterm 256 color code for the 24-bit [red, green, blue] values.

red, green, and blue should each be integers from 0 through 255, inclusive.

x256.from_hex(hex)

Return the nearest xterm 256 color code for the hexadecimal color values.

hex should be string without 0x.

x256.to_rgb(ix)

Return 24-bit [red, green, blue] values from xterm 256 color code.

ix should be integer.

x256.to_hex(ix)

Return hexadecimal color from xterm 256 color code.

ix should be integer.

Install

python -m pip install x256

License

Copyright (c) 2012 Martin Garcia ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].