GSET_COLR_REP(3NCARG)

✨ GSET_COLR_REP ✨

okay bestie, welcome to the NCAR GRAPHICS corner of the manual, where we're talking about gset_colr_rep 🎨 (aka Set color representation) β€” the function that associates a color value with a color index. that's it, that's the whole vibe. let's get into it πŸ’…


🌸 SYNOPSIS 🌸

#include <ncarg/gks.h>

void gset_colr_rep(Gint ws_id, Gint colr_ind, const Gcolr_rep *colr_rep);

πŸ’– DESCRIPTION πŸ’–

here's what you're feeding it, bestie:

  • ws_id β€” (Input) a workstation identifier. and no, you can't just make one up, it has to be the same one you used in some previous gopen_ws call. consistency is the moment. ✨
  • colr_ind β€” (Input) a color index. which slot in the color table are we redecorating today? πŸŽ€
  • colr_rep.rgb.red β€” (Gfloat, Input) the intensity value for red, and it lives between 0. and 1. inclusive. no going outside that range, iykyk. ❀️
  • colr_rep.rgb.green β€” (Gfloat, Input) the intensity value for green, also between 0. and 1. inclusive. πŸ’š
  • colr_rep.rgb.blue β€” (Gfloat, Input) the intensity value for blue, between 0. and 1. inclusive. πŸ’™

three lil floats walk into a struct and now you have a color. iconic behavior fr fr.


πŸ¦‹ USAGE πŸ¦‹

so in GKS, color is "indexed" β€” meaning color attributes get assigned to primitives by using a color index. the GKS function gset_colr_rep is the one you use to associate a color value with those color indices. that's its whole job and it does it well. πŸ‘‘

recommendation time, bestie, listen up: it's recommended that all color indices used in a given job be defined prior to calling any output primitive. and since the result of a dynamic color change can be ambiguous, it's also recommended that you not call gset_colr_rep to change a color value after the original definitions. define it once, define it right, periodt. πŸ’…

gset_colr_rep may be called after opening the workstation for which the color indices are to be defined β€” and not before that workstation is opened. don't come at it early, it's not ready. πŸ™ˆ

and the way that different workstations can keep different color tables?? obsessed. for example, color index 2 for a CGM file may be associated with "red" while at the same time it may be associated with "green" for some X workstation. same index, different eras. main character energy for real. ✨

big important one, do not skip this: color index 0 defines the background color. if any color indices are defined, then you should define the background color index 0. otherwise you run the risk of having a user-defined color match the default background color. and then nothing shows up and you're sitting there like 😭. so. define index 0. pls.

for all GKS output primitives, color is assigned by an indexing scheme. the indices run from 0 to 255, where 0 is the background color index and 1 is the foreground color index. so you got 256 slots, bestie, go decorate. 🌈


πŸŽ€ ACCESS πŸŽ€

to use the GKS C-binding routines, you gotta load the ncarg_gks and ncarg_c libraries. no libraries, no vibes. 🫢


⭐ SEE ALSO ⭐

Online:

  • ginq_colr_rep(3NCARG)
  • gset_line_colr_ind(3NCARG)
  • gset_marker_colr_ind(3NCARG)
  • gset_fill_colr_ind(3NCARG)
  • gset_text_colr_ind(3NCARG)
  • ginq_line_colr_ind(3NCARG)
  • ginq_marker_colr_ind(3NCARG)
  • ginq_fill_colr_ind(3NCARG)
  • ginq_text_colr_ind(3NCARG)
  • gks(3NCARG)
  • ncarg_gks_cbind(3NCARG)

Hardcopy:

  • User's Guide for NCAR GKS-0A Graphics
  • NCAR Graphics Fundamentals, UNIX Version

Copyright (C) 1987-2009 University Corporation for Atmospheric Research The use of this Software is governed by a License Agreement.


and that's the whole page, bestie πŸ’œ this lil gem comes from the UNIX manual, March 1993 edition, filed under GSET_COLR_REP(3NCARG). go forth and set those color representations, you absolute icon πŸ¦‹βœ¨