IMPORTANT NOTE
Under Construction
This project will be completely re-structured OR possibly re-written in C++. This program still works fine, but this workflow is horrible and I can personally do a better job in C++.Convert decimal red, green and blue colors to hexadecimal format from the command line with a few options...
This is a command line utility written in the Rust programming language.
This should work in command lines in Linux, Windows, & MacOs.
I do a lot with color in various environments from web & graphic design to programming and I do many things from the command line and I wanted a more programmatic method than my normal various functions/scripts across various environments and languages that do the same, but I can instead just use this one program across any environment.
This is a cross-platform command line tool in binary executable format that can be used in command lines/consoles/terminals/ttys/shells in Linux, Windows, and MacOs.
This program's name has various versions, but they should all be renamed to: rgbtohexr.
This was written in Linux, but tested in Linux and Windows. Sorry MacOs users; I do not have a Mac, but I do know the operating system well and it has been written properly for the system had compiled successfully as can be seen in this repositories build history and should run fine. Please let me know if it doesn't.
This is currently provided as a compiled binary that is either portable or can be installed in Linux with the Debian - .deb[1] package installer, but if there's enough interest I can also provide an AppImage[2] at some point.
The main program file is meant to be executable and in Windows that's not usually an issue, but in Linux and MacOs you may need to set the permissions.
In a Linux or MacOs command line run:
# executable for all users
chmod +x /path/to/rgbtohexr
# or
chmod 755 /path/to/rgbtohexr
# executable for current user only
chmod u+x /path/to/rgbtohexr This program is portable, but there is a Debian (.deb file) package installer for the Linux binary version.
The file: rgbtohexr.deb is a Linux Debian package installer for use on most Linux Debian based operating systems.
Like many other executable files this should be able to be clicked or double clicked to execute and it should open in the systems software manager gui.
Install from command line with:
sudo dpkg -i /path/to/rgbtohexr.debI imagine this can be installed with gdebi, but I'm not familiar with it.
Uninstall with:
sudo apt remove rgbtohexr
# -y to skip prompt approvalPortable applications do not need to be installed, but they are easier to use if they are in one of a systems PATH directories.
If the program file is not in PATH (or in the current directory) then you must run it with the complete path url:
/path/to/rgbtohexr --helpor
& '\Path\To\rgbtohexr.exe' --helpIf the file is place in PATH then you can run it with:
rgbtohexr --helpPATH directories are stored and can listed in the various operating systems PATH variable.
E.g.
echo "$PATH"| Operating System | Variable Name |
|---|---|
| Linux | $PATH |
| MacOs | $PATH |
| Windows | %PATH% |
Used in many command lines across 3 main operating systems (and more).
3 main operating systems:
- Linux
- Windows
- MacOs
Used in any command line environment from Linux Shell to Windows PowerShell.
- Windows
- CMD
- PowerShell
- Linux
- Shell
- Bash
- Zsh
- many more...
- MacOs
- Same as Linux I imagine.
A few random examples:
╭─«flux»─«~»
╰─»»» rgbtohexr 255 0 0
ff0000
╭─«flux»─«~»
╰─»»» rgbtohexr --html 255 127 127
#ff7f7f
╭─«flux»─«~»
╰─»»» rgbtohexr --upper --hex 255 63 255
0xFF3FFF
╭─«flux»─«~»
╰─»»» rgbtohexr -ut 127 63 255
#7F3FFF
╭─«flux»─«~»
╰─»»» rgbtohexr 127 63 h
Passed argument is not an integer between 0-255.
╭─«flux»─«~»
╰─»»» The Help screen:
╭─«flux»─«~»
╰─»»» rgbtohexr --help
'rgbtohexr'
Convert decimal [Red], [Green], and
[Blue] colors to hexadecimal format.
@USAGE:
rgbtohexr [OPTIONS...]
rgbtohexr INTEGERS...
rgbtohexr [OPTIONS...] INTEGERS...
@OPTIONS:
-h,--help This help screen.
-u,--upper Retrieve output as
uppercase.
-t,--html Retrieve output as
'HTML':'#FFFFFF'
-x,--hex Retrieve output as
'HEX':'0xFFFFFF'
Default format:'FFFFFF'
@INTEGERS:
3 integers from 0-255 that represent the
corresponding [Red],[Green], and [Blue]
colors.
@ERRORS: Exit Codes
0 No errors.
1 Not enough arguments passed.
2 Passed argument is not an
integer between 0-255.
╭─«flux»─«~»
╰─»»» All links pertinent to this project.
All of the most current, up-to-date files are located on the 'Stable Release' page.
Current project links.
Current release files.
These are all the files included under 'Stable Release' on the 'Current Releases' page.
| File Name | Description | Link |
|---|---|---|
| rgbtohexr.deb | Debian package installer. | ./target/release/rgbtohexr.deb |
| rgbtohexr_linux | Main Linux executable. | ./target/release/rgbtohexr_linux |
| rgbtohexr_darwin | Main MacOS executable. | .target/release/rgbtohexr_darwin |
| rgbtohexr_windows.exe | Main Windows executable. | ./target/release/rgbtohexr_windows.exe |
| Description | Status |
|---|---|
| Project Release Date | |
| Total downloads for this project | |
| Complete repository size | |
| Commits in last month | |
| Commits in last year |
| Description | Status |
|---|---|
| Release version | |
| Tag version | |
| Total downloads for current version |
| Name | Status | Code Quality |
|---|---|---|
Linux: Build/Publish |
||
Debian: Build/Publish |
||
Windows: Build/Publish |
||
Macos: Build/Publish |
| # | Description | Link |
|---|---|---|
| 1 | The Debian .deb file is a Linux application package installer/delivery system. |
DuckDuckGo Search |
| 2 | AppImage is a portable executable system with sand-boxing capabilities and no need to worry about dependencies. There isn't much need to have an AppImage with this seeing that it has no dependencies, but if anyone wants it I will considering creating one. | DuckDuckGo Search |
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.


