| /* Dump built-in color scheme of htop |
| Copyright 2015-2022 Rivoreo |
| |
| This program is free software; you can redistribute it and/or modify |
| it under the terms of any version of the GNU General Public License |
| as published by the Free Software Foundation. |
| |
| 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. |
| */ |
| |
| #include "CRT.h" |
| #include <stdio.h> |
| |
| int main(int argc, char **argv) { |
| if(argc != 2) { |
| fprintf(stderr, "Usage: %s <scheme-name>|<scheme-index>\n", argv[0]); |
| return -1; |
| } |
| CRT_initColorSchemes(); |
| endwin(); // CRT_initColorSchemes calls initscr(3X) |
| int i = CRT_getColorSchemeIndexForName(argv[1]); |
| if(i < 0) { |
| char *end_p; |
| i = strtol(argv[1], &end_p, 10); |
| if(*end_p) { |
| fprintf(stderr, "%s: Scheme '%s' not found\n", argv[0], argv[1]); |
| return 1; |
| } |
| if(i < 0 || i >= (int)LAST_COLORSCHEME) { |
| fprintf(stderr, "%s: Index value %d out of range (0~%u)\n", |
| argv[0], i, (unsigned int)LAST_COLORSCHEME); |
| return 1; |
| } |
| } |
| printf("NAME=%s\n", CRT_color_scheme_names[i]); |
| const int *colors = CRT_colorSchemes[i]; |
| #define PRINT_COLOR_ATTRIBUTE(KEY) printf(#KEY "=%d\n", colors[HTOP_##KEY##_COLOR]) |
| PRINT_COLOR_ATTRIBUTE(DEFAULT); |
| PRINT_COLOR_ATTRIBUTE(FUNCTION_BAR); |
| PRINT_COLOR_ATTRIBUTE(FUNCTION_KEY); |
| PRINT_COLOR_ATTRIBUTE(FAILED_SEARCH); |
| PRINT_COLOR_ATTRIBUTE(PANEL_HEADER_FOCUS); |
| PRINT_COLOR_ATTRIBUTE(PANEL_HEADER_UNFOCUS); |
| PRINT_COLOR_ATTRIBUTE(PANEL_SELECTION_FOCUS); |
| PRINT_COLOR_ATTRIBUTE(PANEL_SELECTION_FOLLOW); |
| PRINT_COLOR_ATTRIBUTE(PANEL_SELECTION_UNFOCUS); |
| PRINT_COLOR_ATTRIBUTE(LARGE_NUMBER); |
| PRINT_COLOR_ATTRIBUTE(METER_TEXT); |
| PRINT_COLOR_ATTRIBUTE(METER_VALUE); |
| PRINT_COLOR_ATTRIBUTE(LED_COLOR); |
| PRINT_COLOR_ATTRIBUTE(UPTIME); |
| PRINT_COLOR_ATTRIBUTE(BATTERY); |
| PRINT_COLOR_ATTRIBUTE(TASKS_RUNNING); |
| PRINT_COLOR_ATTRIBUTE(SWAP); |
| PRINT_COLOR_ATTRIBUTE(PROCESS); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_SHADOW); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_TAG); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_MEGABYTES); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_TREE); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_R_STATE); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_D_STATE); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_BASENAME); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_HIGH_PRIORITY); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_LOW_PRIORITY); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_KERNEL_PROCESS); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_THREAD); |
| PRINT_COLOR_ATTRIBUTE(PROCESS_THREAD_BASENAME); |
| PRINT_COLOR_ATTRIBUTE(BAR_BORDER); |
| PRINT_COLOR_ATTRIBUTE(BAR_SHADOW); |
| PRINT_COLOR_ATTRIBUTE(GRAPH_1); |
| PRINT_COLOR_ATTRIBUTE(GRAPH_2); |
| PRINT_COLOR_ATTRIBUTE(MEMORY_USED); |
| PRINT_COLOR_ATTRIBUTE(MEMORY_BUFFERS); |
| PRINT_COLOR_ATTRIBUTE(MEMORY_BUFFERS_TEXT); |
| PRINT_COLOR_ATTRIBUTE(MEMORY_CACHE); |
| PRINT_COLOR_ATTRIBUTE(MEMORY_ZFS_ARC); |
| PRINT_COLOR_ATTRIBUTE(LOAD); |
| PRINT_COLOR_ATTRIBUTE(LOAD_AVERAGE_FIFTEEN); |
| PRINT_COLOR_ATTRIBUTE(LOAD_AVERAGE_FIVE); |
| PRINT_COLOR_ATTRIBUTE(LOAD_AVERAGE_ONE); |
| PRINT_COLOR_ATTRIBUTE(CHECK_BOX); |
| PRINT_COLOR_ATTRIBUTE(CHECK_MARK); |
| PRINT_COLOR_ATTRIBUTE(CHECK_TEXT); |
| PRINT_COLOR_ATTRIBUTE(CLOCK); |
| PRINT_COLOR_ATTRIBUTE(HELP_BOLD); |
| PRINT_COLOR_ATTRIBUTE(HOSTNAME); |
| PRINT_COLOR_ATTRIBUTE(CPU_NICE); |
| PRINT_COLOR_ATTRIBUTE(CPU_NICE_TEXT); |
| PRINT_COLOR_ATTRIBUTE(CPU_NORMAL); |
| PRINT_COLOR_ATTRIBUTE(CPU_KERNEL); |
| PRINT_COLOR_ATTRIBUTE(CPU_IOWAIT); |
| PRINT_COLOR_ATTRIBUTE(CPU_IRQ); |
| PRINT_COLOR_ATTRIBUTE(CPU_SOFTIRQ); |
| PRINT_COLOR_ATTRIBUTE(CPU_STEAL); |
| PRINT_COLOR_ATTRIBUTE(CPU_GUEST); |
| #undef PRINT_COLOR_ATTRIBUTE |
| return 0; |
| } |