diff --git a/src/parse_yaml_theme.pl b/src/parse_yaml_theme.pl index ba31e03..f2d0162 100755 --- a/src/parse_yaml_theme.pl +++ b/src/parse_yaml_theme.pl @@ -10,7 +10,7 @@ # Author: Steven Bakker (SB), # Created: 17 Dec 2014 # -# Copyright (c) 2014-2017 Steven Bakker; All rights reserved. +# Copyright (c) 2014-2022 Steven Bakker; All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the same terms as Perl itself. See "perldoc perlartistic". @@ -83,6 +83,9 @@ elsif ($key eq 'show') { show_palette(\%scheme, $palette_ref); } + elsif ($key eq 'roxterm') { + print_roxterm(\%scheme, $palette_ref); + } elsif ($key eq 'yaml') { print YAML::Dump($theme_ref); } @@ -272,6 +275,22 @@ sub demo_string { return rgb_start($bg, $fg).$str.rgb_end(); } +sub print_roxterm { + my ($scheme, $palette_ref) = @_; + + my $palette_size = int( @{$palette_ref} ); + + say "[roxterm colour scheme]\n", + "foreground=$scheme->{fg}\n", + "background=$scheme->{bg}\n", + "bold=$scheme->{bd}\n", + "palette_size=$palette_size"; + + for my $i (0..$palette_size-1) { + say "$i=$palette_ref->[$i]"; + } +} + sub show_palette { my ($scheme, $palette_ref) = @_; @@ -336,13 +355,67 @@ =head1 SYNOPSIS B I -[B|B|B|B|B|B|B|B|B] ... +I ... + +=over + +=item Command: + +B, B, B, B, B, B, +B, B, B, B + +=back =head1 DESCRIPTION Read I for the values of a GNOME terminal theme. Spit out the colours on STDOUT. +=head1 COMMANDS + +=over + +=item B, B, B + +Print the values for bold, background, and foreground colour, resp. + +=item B + +Produce output files that are compatible with the default C +of L. Will write four files: +F, +F, +F, +and F. + +=item B + +Print the palette as a L(1) string. + +=item B + +Print the palette as a C string (see +L). + +=item B + +Print the colour profile as a L(1) colour file. + +=item B + +Print the colour profile as a set of shell variables. + +=item B + +Demonstrate the colour profile in the terminal. + +=item B + +Print back the colour profile as a YAML file, where anchors/references +have been replaced. + +=back + =head1 OPTIONS =over @@ -420,9 +493,9 @@ =head2 Palette Output fg_color: |++| bg_color: |--| palette: - Black Red Green Yellow Blue Magenta Cyan White - Normal: [-----] [-----] [-----] [-----] [-----] [-----] [-----] [-----] - Bright: [+++++] [+++++] [+++++] [+++++] [+++++] [+++++] [+++++] [+++++] + Black Red Green Yellow Blue Magenta Cyan White + Normal: [-----] [---] [-----] [-----] [----] [-----] [----] [-----] + Bright: [+++++] [+++] [+++++] [+++++] [++++] [+++++] [++++] [+++++] =head2 Default Output @@ -453,15 +526,17 @@ =head2 Output for "install.sh" bd_color='#E3E3CECEABAB' bg_color='#1C1C1C1C1C1C' fg_color='#BABABDBDB6B6' - palette_dconf="'#1C1C1C1C1C1C', '#CCCC93939393', '#7F7F9F9F7F7F', \ - '#E3E3CECEABAB', '#DFDFAFAF8F8F', '#CCCC93939393', '#8C8CD0D0D3D3', \ - '#BABABDBDB6B6', '#3F3F3F3F3F3F', '#CCCC93939393', '#7F7F9F9F7F7F', \ - '#E3E3CECEABAB', '#DFDFAFAF8F8F', '#CCCC93939393', '#8C8CD0D0D3D3', \ - '#DCDCDCDCCCCC'" - palette_gconf='#1C1C1C1C1C1C:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:\ - #DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#BABABDBDB6B6:#3F3F3F3F3F3F:\ - #CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:\ - #8C8CD0D0D3D3:#DCDCDCDCCCCC' + palette_dconf="'#1C1C1C1C1C1C', '#CCCC93939393', + '#7F7F9F9F7F7F', '#E3E3CECEABAB', '#DFDFAFAF8F8F', \ + '#CCCC93939393', '#8C8CD0D0D3D3', '#BABABDBDB6B6', \ + '#3F3F3F3F3F3F', '#CCCC93939393', '#7F7F9F9F7F7F', \ + '#E3E3CECEABAB', '#DFDFAFAF8F8F', '#CCCC93939393', \ + '#8C8CD0D0D3D3', '#DCDCDCDCCCCC'" + palette_gconf='#1C1C1C1C1C1C:#CCCC93939393:#7F7F9F9F7F7F:\ + #E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:\ + #BABABDBDB6B6:#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:\ + #E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:\ + #DCDCDCDCCCCC' Typical usage: @@ -513,6 +588,34 @@ =head2 Palette Strings #3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:\ #DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC +=head2 Roxterm Colour Scheme + +The C command will print the colour theme in the +L format: + + $ parse_yaml_theme.pl steven.yaml roxterm + [roxterm colour scheme] + foreground=#BABABDBDB6B6 + background=#1C1C1C1C1C1C + bold=#E3E3CECEABAB + palette_size=16 + 0=#1C1C1C1C1C1C + 1=#CCCC93939393 + 2=#7F7F9F9F7F7F + 3=#E3E3CECEABAB + 4=#DFDFAFAF8F8F + 5=#CCCC93939393 + 6=#8C8CD0D0D3D3 + 7=#BABABDBDB6B6 + 8=#3F3F3F3F3F3F + 9=#CCCC93939393 + 10=#7F7F9F9F7F7F + 11=#E3E3CECEABAB + 12=#DFDFAFAF8F8F + 13=#CCCC93939393 + 14=#8C8CD0D0D3D3 + 15=#DCDCDCDCCCCC + =head1 EXIT CODE =over @@ -527,13 +630,20 @@ =head1 EXIT CODE =back +=head1 SEE ALSO + +L(1), +L(1), +L(1), +L(1). + =head1 AUTHOR Steven Bakker Esb@monkey-mind.netE. =head1 COPYRIGHT AND LICENSE -Copyright (c) 2014-2017 Steven Bakker; All rights reserved. +Copyright (c) 2014-2022 Steven Bakker; All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See "perldoc perlartistic".