#!/bin/bash # # SPDX-License-Identifier: GPL-2.0-or-later # # 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 2 of the License, or # (at your option) any later version. # # Copyright (C) 2025 Karel Zak # TS_TOPDIR="${0%/*}/../.." TS_DESC="colors" . "$TS_TOPDIR"/functions.sh ts_init "$*" ts_check_test_command "$TS_HELPER_COLORS" ts_cd "$TS_OUTDIR" SRC="${top_srcdir}/lib/color-names.c" COLOR_NAMES=$(awk ' /basic_schemes\[\]/ { in_array=1; next } in_array && /};/ { exit } in_array && /\{[[:space:]]*"/ { sub(/.*\{[[:space:]]*"/, "") if (match($0, /[^"]*/)) { name = substr($0, RSTART, RLENGTH) print name } } ' "$SRC") for color in $COLOR_NAMES; do printf "%15s: " "$color" >> $TS_OUTPUT $TS_HELPER_COLORS --mode always --color "$color" >> $TS_OUTPUT 2>> $TS_ERRLOG done ts_finalize