Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify GMT_RGBchart.sh by only producing tabloid size in modern mode #6527

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions doc/rst/source/gmtcolors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ List Of Colors
The chart below lists the 663 unique color names that can be used in GMT.

**Download PDF versions:**
:download:`A4 size </_images/GMT_RGBchart_a4.pdf>`,
:download:`US letter size </_images/GMT_RGBchart_letter.pdf>`,
:download:`Tabloid size </_images/GMT_RGBchart_tabloid.pdf>`
:download:`US tabloid size </_images/GMT_RGBchart.pdf>`

.. _RGBchart:

Expand Down
2 changes: 1 addition & 1 deletion doc/scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (SPHINX_FOUND)
endforeach (_fig ${_scripts_ps2png})

# Convert PS to PDF
set (_scripts_ps2pdf images/GMT_RGBchart_a4.ps images/GMT_RGBchart_letter.ps images/GMT_RGBchart_tabloid.ps images/GMT_App_F_stand+_iso+.ps images/GMT_App_F_symbol_dingbats.ps)
set (_scripts_ps2pdf images/GMT_RGBchart.ps images/GMT_App_F_stand+_iso+.ps images/GMT_App_F_symbol_dingbats.ps)
set (_scripts_pdf)
foreach (_fig ${_scripts_ps2pdf})
string (REPLACE ".ps" ".pdf" _pdf_fig ${_fig})
Expand Down
43 changes: 15 additions & 28 deletions doc/scripts/GMT_RGBchart.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
#!/usr/bin/env bash
#
# Plots a page of all 663 unique named colors
# Usage: GMT_RGBchart.sh <size>
# where <size> is the page size. Use either: tabloid, a4, or letter
# This produces the file GMT_RGBchart_<size>.ps

SIZE=$1
COL=16
ROW=35

if [ "X"$SIZE"" = "Xletter" ] ; then
WIDTH=10.5
HEIGHT=8.0
ORIENT=landscape
elif [ "X"$SIZE"" = "Xa4" ] ; then
WIDTH=11.2
HEIGHT=7.8
else
SIZE=tabloid
WIDTH=16.5
HEIGHT=10.5
fi

ps=GMT_RGBchart_$SIZE.ps
WIDTH=16.5
HEIGHT=10.5
allinfo=allinfo.tmp
cpt=lookup.cpt
rects=rects.tmp
whitetags=whitetags.tmp
blacktags=blacktags.tmp
labels=labels.tmp
gmt set PS_MEDIA $SIZE PS_PAGE_ORIENTATION landscape

rectheight=0.56
W=$(gmt math -Q $WIDTH $COL DIV 0.95 MUL =)
Expand All @@ -51,17 +34,21 @@ $AWK -v h=$rectheight -v fs=$fontsize '{if ($2 <= 127) printf "%g %g %gp,1 %s\n
$AWK -v h=$rectheight -v fs=$fontsize '{if ($2 > 127) printf "%g %g %gp,1 %s\n",$4+0.5,$5+1-0.5*h,fs,$1}' $allinfo > $blacktags
$AWK -v h=$textheight -v fs=$fontsizeL '{printf "%g %g %gp,1 @#%s@#\n",$4+0.5,$5+0.6*h,fs,$3}' $allinfo > $labels

# Plot all tiles and texts
gmt psxy -R0/$COL/0/$ROW -JX$WIDTH/-$HEIGHT -X0.25i -Y0.25i -B0 -C$cpt -Sri -W $rects -K > $ps
gmt pstext -R -J -O -K $labels -F+f --FONT=black >> $ps
gmt pstext -R -J -O -K $blacktags -F+f --FONT=black >> $ps
gmt pstext -R -J -O -K $whitetags -F+f --FONT=white >> $ps
gmt begin GMT_RGBchart
gmt set PS_MEDIA tabloid PS_PAGE_ORIENTATION landscape

# Plot all tiles and texts
gmt plot -R0/$COL/0/$ROW -JX$WIDTH/-$HEIGHT -X0.25i -Y0.25i -B0 -C$cpt -Sri -W $rects
gmt text $labels -F+f --FONT=black
gmt text $blacktags -F+f --FONT=black
gmt text $whitetags -F+f --FONT=white

# Put logo in top left corner
gmt logo -R -J -O -K -Dg0.5/1+jMC+w$W >> $ps
# Put logo in top left corner
gmt logo -Dg0.5/1+jMC+w$W

height=$(gmt math -Q $HEIGHT $ROW DIV =)
gmt pslegend -O -R -J -DjBR+w$WIDTH >> $ps <<END
height=$(gmt math -Q $HEIGHT $ROW DIV =)
gmt legend -DjBR+w$WIDTH <<END
L ${fontsizeL}p,Helvetica-Bold R Values are R/G/B. Names are case-insensitive.
L ${fontsizeL}p,Helvetica-Bold R Optionally, use GREY instead of GRAY.
END
gmt end show
6 changes: 3 additions & 3 deletions doc/scripts/images.dvc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outs:
- md5: 1402b2febdf291b6ad7565930bb11078.dir
size: 31158451
nfiles: 195
- md5: f5855571690284f25bb0108cc392580e.dir
size: 30530547
nfiles: 192
path: images