diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2020-08-16 13:49:09 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2020-08-16 13:49:09 +0530 |
commit | 5db229895691f37f4f618a8da3e45aea37e7572f (patch) | |
tree | 2b634c41b7e016f280369e3be9e9b3c9743718af /src/icons.h | |
parent | d86810a42587527191e0de15c252a92932a4ef4a (diff) | |
download | nnn-5db229895691f37f4f618a8da3e45aea37e7572f.tar.gz |
Support icon-specific colors
Diffstat (limited to 'src/icons.h')
-rw-r--r-- | src/icons.h | 114 |
1 files changed, 64 insertions, 50 deletions
diff --git a/src/icons.h b/src/icons.h index 69872be..97a624d 100644 --- a/src/icons.h +++ b/src/icons.h @@ -3,7 +3,11 @@ struct icon_pair { const char *match; const char *icon; - const unsigned char color; /* Hex xterm 256 color code, 0 to follow file specific */ + /* + * Hex xterm 256 color code, 0 to follow file specific (if any) + * Codes: https://jonasjacek.github.io/colors/ + */ + const unsigned char color; }; /* @@ -14,14 +18,21 @@ struct icon_pair { #define ICON_PADDING_LEFT "" #define ICON_PADDING_RIGHT " " +#define VIDEO_COLOR 93 /* Purple */ +#define AUDIO_COLOR 220 /* Gold1 */ +#define IMAGE_COLOR 82 /* Chartreuse2 */ +#define BOOKS_COLOR 202 /* OrangeRed1 */ +#define ARCHIVE_COLOR 209 /* Salmon1 */ + /* * Using symbols defined in icons-in-terminal.h, or even using icons-in-terminal is not necessary. * You can use whatever pathched font you like. You just have to put the desired icon as a string. * If you are using icons-in-terminal the creator recommends that you do use the symbols in the generated header. */ -static const struct icon_pair dir_icon = {"", FA_FOLDER, 0}; -static const struct icon_pair file_icon = {"", FA_FILE, 0}; +static const struct icon_pair dir_icon = {"", FA_FOLDER, 0}; +static const struct icon_pair file_icon = {"", FA_FILE_O, 0}; +static const struct icon_pair exec_icon = {"", FA_TERMINAL, 0}; /* All entries are case-insensitive */ @@ -46,26 +57,26 @@ static const struct icon_pair icons_name[] = { static const struct icon_pair icons_ext[] = { /* Numbers */ - {"7z", FA_FILE_ARCHIVE_O, 0}, + {"7z", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, /* A */ {"a", FILE_MANPAGE, 0}, - {"apk", FA_FILE_ARCHIVE_O, 0}, + {"apk", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"asm", FILE_NASM, 0}, - {"aup", FA_FILE_AUDIO_O, 0}, - {"avi", FA_FILE_MOVIE_O, 0}, + {"aup", FA_FILE_AUDIO_O, AUDIO_COLOR}, + {"avi", FA_FILE_MOVIE_O, VIDEO_COLOR}, /* B */ {"bat", MFIZZ_SCRIPT, 0}, - {"bmp", FA_FILE_IMAGE_O, 0}, - {"bz2", FA_FILE_ARCHIVE_O, 0}, + {"bmp", FA_FILE_IMAGE_O, IMAGE_COLOR}, + {"bz2", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, /* C */ {"c", MFIZZ_C, 0}, {"c++", MFIZZ_CPLUSPLUS, 0}, - {"cab", FA_FILE_ARCHIVE_O, 0}, - {"cbr", FA_FILE_ARCHIVE_O, 0}, - {"cbz", FA_FILE_ARCHIVE_O, 0}, + {"cab", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, + {"cbr", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, + {"cbz", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"cc", MFIZZ_CPLUSPLUS, 0}, {"class", MFIZZ_JAVA, 0}, {"clj", MFIZZ_CLOJURE, 0}, @@ -74,16 +85,16 @@ static const struct icon_pair icons_ext[] = { {"cmake", FILE_CMAKE, 0}, {"coffee", MFIZZ_COFFEE_BEAN, 0}, {"conf", FA_COGS, 0}, - {"cpio", FA_FILE_ARCHIVE_O, 0}, + {"cpio", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"cpp", MFIZZ_CPLUSPLUS, 0}, {"css", MFIZZ_CSS3, 0}, - {"cue", FA_FILE_AUDIO_O, 0}, + {"cue", FA_FILE_AUDIO_O, AUDIO_COLOR}, {"cvs", FA_COGS, 0}, {"cxx", MFIZZ_CPLUSPLUS, 0}, /* D */ {"db", MFIZZ_DATABASE_ALT2, 0}, - {"deb", MFIZZ_DEBIAN, 0}, + {"deb", MFIZZ_DEBIAN, ARCHIVE_COLOR}, {"dll", FILE_MANPAGE, 0}, {"doc", FILE_WORD, 0}, {"docx", FILE_WORD, 0}, @@ -91,13 +102,13 @@ static const struct icon_pair icons_ext[] = { /* E */ {"ejs", FA_FILE_CODE_O, 0}, {"elf", FA_LINUX, 0}, - {"epub", FA_FILE_PDF_O, 0}, + {"epub", FA_FILE_PDF_O, BOOKS_COLOR}, {"exe", FA_WINDOWS, 0}, /* F */ {"f#", DEV_FSHARP, 0}, - {"flac", FA_FILE_AUDIO_O, 0}, - {"flv", FA_FILE_MOVIE_O, 0}, + {"flac", FA_FILE_AUDIO_O, AUDIO_COLOR}, + {"flv", FA_FILE_MOVIE_O, VIDEO_COLOR}, {"fs", DEV_FSHARP, 0}, {"fsi", DEV_FSHARP, 0}, {"fsscript", DEV_FSHARP, 0}, @@ -105,10 +116,10 @@ static const struct icon_pair icons_ext[] = { /* G */ {"gem", FA_FILE_ARCHIVE_O, 0}, - {"gif", FA_FILE_IMAGE_O, 0}, + {"gif", FA_FILE_IMAGE_O, IMAGE_COLOR}, {"go", MFIZZ_GO, 0}, - {"gz", FA_FILE_ARCHIVE_O, 0}, - {"gzip", FA_FILE_ARCHIVE_O, 0}, + {"gz", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, + {"gzip", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, /* H */ {"h", MFIZZ_C, 0}, @@ -120,17 +131,17 @@ static const struct icon_pair icons_ext[] = { {"hxx", MFIZZ_CPLUSPLUS, 0}, /* I */ - {"ico", FA_FILE_IMAGE_O, 0}, - {"img", FA_FILE_IMAGE_O, 0}, + {"ico", FA_FILE_IMAGE_O, IMAGE_COLOR}, + {"img", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"ini", FA_COGS, 0}, - {"iso", LINEA_MUSIC_CD, 0}, + {"iso", LINEA_MUSIC_CD, ARCHIVE_COLOR}, /* J */ {"jar", MFIZZ_JAVA, 0}, {"java", MFIZZ_JAVA, 0}, {"jl", FA_COGS, 0}, - {"jpeg", FA_FILE_IMAGE_O, 0}, - {"jpg", FA_FILE_IMAGE_O, 0}, + {"jpeg", FA_FILE_IMAGE_O, IMAGE_COLOR}, + {"jpg", FA_FILE_IMAGE_O, IMAGE_COLOR}, {"js", DEV_JAVASCRIPT_BADGE, 0}, {"json", MFIZZ_JAVASCRIPT, 0}, {"jsx", FILE_JSX, 0}, @@ -138,36 +149,36 @@ static const struct icon_pair icons_ext[] = { /* K */ /* L */ - {"lha", FA_FILE_ARCHIVE_O, 0}, + {"lha", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"log", FA_FILE_TEXT_O, 0}, {"lua", FILE_LUA, 0}, - {"lzh", FA_FILE_ARCHIVE_O, 0}, - {"lzma", FA_FILE_ARCHIVE_O, 0}, + {"lzh", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, + {"lzma", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, /* M */ - {"m4a", FA_FILE_AUDIO_O, 0}, - {"m4v", FA_FILE_MOVIE_O, 0}, + {"m4a", FA_FILE_AUDIO_O, AUDIO_COLOR}, + {"m4v", FA_FILE_MOVIE_O, VIDEO_COLOR}, {"markdown", OCT_MARKDOWN, 0}, {"md", OCT_MARKDOWN, 0}, - {"mkv", FA_FILE_MOVIE_O, 0}, - {"mov", FA_FILE_MOVIE_O, 0}, - {"mp3", FA_FILE_AUDIO_O, 0}, - {"mp4", FA_FILE_MOVIE_O, 0}, - {"mpeg", FA_FILE_MOVIE_O, 0}, - {"mpg", FA_FILE_MOVIE_O, 0}, + {"mkv", FA_FILE_MOVIE_O, VIDEO_COLOR}, + {"mov", FA_FILE_MOVIE_O, VIDEO_COLOR}, + {"mp3", FA_FILE_AUDIO_O, AUDIO_COLOR}, + {"mp4", FA_FILE_MOVIE_O, VIDEO_COLOR}, + {"mpeg", FA_FILE_MOVIE_O, VIDEO_COLOR}, + {"mpg", FA_FILE_MOVIE_O, VIDEO_COLOR}, {"msi", FA_WINDOWS, 0}, /* N */ /* O */ {"o", FILE_MANPAGE, 0}, - {"ogg", FA_FILE_AUDIO_O, 0}, + {"ogg", FA_FILE_AUDIO_O, AUDIO_COLOR}, {"out", FA_LINUX, 0}, /* P */ - {"pdf", FA_FILE_PDF_O, 0}, + {"pdf", FA_FILE_PDF_O, BOOKS_COLOR}, {"php", MFIZZ_PHP, 0}, - {"png", FA_FILE_IMAGE_O, 0}, + {"png", FA_FILE_IMAGE_O, IMAGE_COLOR}, {"ppt", FILE_POWERPOINT, 0}, {"pptx", FILE_POWERPOINT, 0}, {"psb", DEV_PHOTOSHOP, 0}, @@ -180,10 +191,10 @@ static const struct icon_pair icons_ext[] = { /* Q */ /* R */ - {"rar", FA_FILE_ARCHIVE_O, 0}, + {"rar", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"rc", FA_COGS, 0}, {"rom", FA_LOCK, 0}, - {"rpm", FA_FILE_ARCHIVE_O, 0}, + {"rpm", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"rss", FA_RSS_SQUARE, 0}, {"rtf", FA_FILE_PDF_O, 0}, @@ -194,15 +205,16 @@ static const struct icon_pair icons_ext[] = { {"slim", FA_FILE_CODE_O, 0}, {"sln", DEV_VISUALSTUDIO, 0}, {"sql", MFIZZ_MYSQL, 0}, - {"svg", FA_FILE_IMAGE_O, 0}, + {"svg", FA_FILE_IMAGE_O, IMAGE_COLOR}, /* T */ - {"tar", FA_FILE_ARCHIVE_O, 0}, + {"tar", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"tex", FILE_TEX, 0}, - {"tgz", FA_FILE_ARCHIVE_O, 0}, + {"tgz", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"ts", FILE_TS, 0}, {"tsx", FILE_TSX, 0}, {"txt", FA_FILE_TEXT_O, 0}, + {"txz", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, /* U */ @@ -211,23 +223,25 @@ static const struct icon_pair icons_ext[] = { {"vimrc", DEV_VIM, 0}, /* W */ - {"wav", FA_FILE_AUDIO_O, 0}, - {"webm", FA_FILE_MOVIE_O, 0}, + {"wav", FA_FILE_AUDIO_O, AUDIO_COLOR}, + {"webm", FA_FILE_MOVIE_O, VIDEO_COLOR}, + {"wma", FA_FILE_AUDIO_O, AUDIO_COLOR}, + {"wmv", FA_FILE_MOVIE_O, VIDEO_COLOR}, /* X */ - {"xbps", FA_FILE_ARCHIVE_O, 0}, + {"xbps", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, {"xhtml", FA_FILE_CODE_O, 0}, {"xls", FILE_EXCEL, 0}, {"xlsx", FILE_EXCEL, 0}, {"xml", FA_FILE_CODE_O, 0}, - {"xz", FA_FILE_ARCHIVE_O, 0}, + {"xz", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR}, /* Y */ {"yaml", FA_COGS, 0}, {"yml", FA_COGS, 0}, /* Z */ - {"zip", FA_FILE_ARCHIVE_O, 0} + {"zip", FA_FILE_ARCHIVE_O, ARCHIVE_COLOR} /* Other */ }; |