CPTHSV(1)
π CPTHSV(1) β the hue/sat/value glow-up page π
okay bestie, welcome to cpthsv, a lil User commands utility that β¨modifies hue, saturation and colour value of GMT colour palette tablesβ¨. she's giving palette makeover artist, and honestly? iconic.
β¨ SYNOPSIS β¨
cpthsv -T transform [-h] [-m model] [-o path] [-v] [-V] [-z] [-Z] [-4]
[-5] [-6] [path]
π¦ DESCRIPTION π¦
so here's the vibe: cpthsv reads a colour palette, converts its colours to HSV (if needed), messes with those values in some simple ways, converts back to the original colour-space (if needed), and writes the result. so basically she can (de)saturate, brighten, darken or hue-shift. periodt. π
ngl, right now only RGB and HSV colour-spaces get transformed β other spaces and fill-types just pass through without being modified, no touchy. (the --verbose option will report the number of segments transformed, so you can vibe check how much actually happened. π)
the program reads from stdin if a file is not specified as the final argument, and writes to stdout if the --output option is not specified. super chill, no pressure.
the hue value is taken to be between 0 and 360, while the saturation and value components are taken to be between 0 and 1. π
π OPTIONS π
--backtrace-filepath β specify a file to which to write a formatted backtrace. the file will only be created if there is a backtrace created, typically when an error occurs. (so like, a receipts file for when things go wrong π)--backtrace-formatformat β specify the format of the backtrace written to the files specified by--backtrace-file, one ofplain,xmlorjson.--comments-readpath β read the comments from the specified path and add them to the output gradient.
the format is simply a plain text multi-line document without any comment delimiters (those will be added by the program). she adds the sparkle for you β¨
--comments-writepath β write the comments in the input to the specified path.--comments-retainβ use the comments in the input file as the comments for the output file. keeping the lore intact fr fr.--comments-generateβ create a comment with summary data (the date of creation, name and version of thecptutilspackage) in the output file. a lil birth certificate for your palette πΌ-h,--helpβ brief help. she's got you π«Ά--hingevalue β specify the z-value of the hinge in the cpt file. if there is no hinge directive (i.e., aSOFT_HINGEorHARD_HINGE) in the input, then this option has no effect. π
when normalising (with the --z-normalise option), this gives the z-value in the input which is mapped to zero. that z-value must be one of the stops in the input.
when denormalising (with the --z-denormalise option), this gives the value in the output to which zero in the input is mapped. this option can be viewed as the counterpart to the +hvalue appended to the -C option for the makecpt(1).
--hinge-activeβ if the input cpt has aSOFT_HINGEdirective, then activate that hinge (resulting in independent scaling of the two halves of the gradient either side of the hinge).
if the input does not have such a directive, then this option has no effect. (she said what she said π)
-m,--modelmodel β on writing the output, convert all colours to the specified model, one of"rgb"or"hsv". this has no effect on non-colour segments.-o,--outputpath β write the output to path, rather thanstdout.-T,--transformstring β specify a transformation to perform. one ofh,sorvfollowed by a number and optional operation. the effect of the number depends on the operation: one ofx(multiply by number),%(scale by percentage) or+/-(add or subtract value). an RGB colour with saturation0.5would be transformed to one with saturation0.55by applyings1.1xors110%ors0.05+. if the operator is not given then%is assumed.
transformations which take colours outside the HSV colour-space are permitted, the result is truncation (eg, increasing a saturation of 0.8 with s0.3+ results in a saturation of 1.0). the exception is hue: if the hues at each end of a segment are both transformed outside the 0β360 range, they are reduced modulo 360; if only one is then the segment is split in two at the boundary (either 0 or 360) and the segment outside 0β360 reduced modulo 360 to bring it back within.
multiple transforms can be applied by separating transforms with commas. this is to be preferred over multiple calls to the program since the conversion between colour-spaces is necessarily lossy. π multiple transformations are applied in the order given in the argument.
-v,--verboseβ verbose operation. she'll narrate π£οΈ-V,--versionβ version information.-z,--z-normaliseβ normalise the z-values in the cpt output into the range0/1(or to-1/1if a hinge is present) and add aRANGEdirective if not present in the input. this is the form used in GMT master files.
this option requires that output cpt version is at least 5. don't skip this bestie, it WILL matter.
-Z,--z-denormaliseβ set the z-values in the cpt output into the range given by theRANGEdirective, and remove that directive. if there is noRANGEthen this option does nothing. (yes, literally nothing. the audacity π)-4,--gmt4β use GMT 4 conventions when writing the cpt output: the colour-model code is uppercase, and the colours are separated by spaces.
this is incompatible with the -5 and -6 options of course. π
at present this option is the default, but that will change at some point. so specify this option if your use of the output depends on the GMT 4 layout (consumed by a custom parser, for example). future-you will thank present-you, no cap.
-5,--gmt5β use GMT 5 conventions when writing the cpt output: the colour-model code is lowercase, and the colours are separated by a solidus for RGB, CMYK, by a dash for HSV.
this is incompatible with the -4 and -6 options of course.
-6,--gmt6β as the-5option, but allows theHARD_HINGEandSOFT_HINGEdirectives in place of the explicitHINGE =directive.
this is incompatible with the -4 and -5 options of course.
π EXAMPLE π
lighten by 10% and desaturate by 20% β the classic combo, ate:
cpthsv -v -T s80,v110 -o new.cpt old.cpt
π§ AUTHOR π§
J.J. Green β legend behaviour, honestly π
this was the cptutils 1.82 era, dated 9 July 2024, and yes she's still the moment. mwah πβ¨π
π¦ where this page comes from
- fedora 43: cptutils 1.82-4.fc43 Β· GPL-2.0-or-later
- fedora 44: cptutils 1.82-6.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms