| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# |
| 4 |
# SPDX-License-Identifier: GPL-2.0-or-later |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; either version 2 of the License, or |
| 9 |
# (at your option) any later version. |
| 10 |
# |
| 11 |
# Copyright (C) 2025 Karel Zak <[email protected]> |
| 12 |
# |
| 13 |
TS_TOPDIR="${0%/*}/../.." |
| 14 |
TS_DESC="colors" |
| 15 |
|
| 16 |
. "$TS_TOPDIR"/functions.sh |
| 17 |
ts_init "$*" |
| 18 |
|
| 19 |
ts_check_test_command "$TS_HELPER_COLORS" |
| 20 |
ts_cd "$TS_OUTDIR" |
| 21 |
|
| 22 |
SRC="${top_srcdir}/lib/color-names.c" |
| 23 |
|
| 24 |
COLOR_NAMES=$(awk ' |
| 25 |
/basic_schemes\[\]/ { in_array=1; next } |
| 26 |
in_array && /};/ { exit } |
| 27 |
in_array && /\{[[:space:]]*"/ { |
| 28 |
sub(/.*\{[[:space:]]*"/, "") |
| 29 |
if (match($0, /[^"]*/)) { |
| 30 |
name = substr($0, RSTART, RLENGTH) |
| 31 |
print name |
| 32 |
} |
| 33 |
} |
| 34 |
' "$SRC") |
| 35 |
|
| 36 |
for color in $COLOR_NAMES; do |
| 37 |
printf "%15s: " "$color" >> $TS_OUTPUT |
| 38 |
$TS_HELPER_COLORS --mode always --color "$color" >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 39 |
done |
| 40 |
|
| 41 |
ts_finalize |
| 42 |
|