*! Version 1.0 by Mead Over, 31Aug2018
*! Based on version 1.01 of vgcolormap by Michael Mitchell, author of "A Visual Guide to Stata Graphics"
program cgd_colormap
	syntax [, Quietly ]
	preserve
	set more off
	qui drop _all
	local lista  ///
		cgdteal cgddkgray cgdwmgray cgdred cgdorange cgdyellow   ///
		teal dkgray wmgray red orange yellow   ///
		cgdgreen cgdblue cgdpurple cgdbeige cgdbluegray cgdltgray  ///
		green blue purple beige bluegray ltgray

	local xmax = 6
	local targname mcolor
	local title "Color Map of CGD Colors Compared to Standard Stata Colors"
	local cmd
	qui set obs 0
	qui gen x = .
	qui gen y = .
	qui gen str10 s = ""
	local x = 0
	local y = 1
	foreach ela of local lista {
		local `targname' `ela'
		local x = `x'+1
		if `x' > `xmax' {
			local y = `y' + 1
			local x = 1
		}
		local obs = `=_N'+1
		qui set obs `obs'
		qui replace y = `y' in l
		qui replace x = `x' in l
		qui replace s = "`ela'" in l
		local c "sc y x in `=_N', pstyle(p1) mcolor(`mcolor') mlabel(s) mlabpos(3) msize(huge) msymbol(S)" // 7/26/04, added msymbol(S)
		local cmd "`cmd' (`c')"
	}
	* di "`cmd'"
	local topx = `xmax' + .6
	local topy = `y' + 1
	`quietly' di as text "Rendering colors, please wait"
	capture twoway `cmd', ysca(r(0 `topy')) xsca(r(.8 `topx'))	///
		xlab(none) ylab(none) ysca(reverse)			///
		xtitle("") ytitle("") title("`title'")			///
		legend(nodraw)
end