XmColorSelector(3X)

πŸ’– XmColorSelector πŸ’–

okay bestie, welcome to the Color Selector widget β€” that's XmColorSelector(3X) if you're being formal, but we're not πŸ’…


✨ SYNOPSIS ✨

#include <Xm/ColorS.h>

🌈 DESCRIPTION 🌈

so like. the Color Selector widget lets your user pick a color, and they've got two whole ways to do it: sliding around a set of RGB sliders, or scrolling through a list of literally every color that exists in the rgb database. and the way it just... shows them the name or the rgb value of whatever they're hovering on, live, as they pick and choose? it's giving main character energy, no cap. the color they selected gets displayed too. obsessed. πŸŽ€

🌸 Normal Resources 🌸

here's the whole menu, bestie. every single one:

  • blueSliderLabel β€” class SliderLabel, type XmString, initial value "Blue"
  • colorListTogLabel β€” class TogLabel, type XmString, initial value "Color List"
  • colorMode β€” class ColorMode, type XiColorMode, initial value XmScaleMode
  • colorName β€” class String, type String, initial value White
  • fileReadError β€” class FileReadError, type XmString, initial value "Could not read RGB.txt file"
  • greenSliderLabel β€” class SliderLabel, type XmString, initial value "Green"
  • marginHeight β€” class MarginHeight, type VerticalDimension, initial value 2
  • marginWidth β€” class MarginWidth, type HorizontalDimension, initial value 2
  • noCellError β€” class NoCellError, type XmString, initial value "No Color Cell Available"
  • redSliderLabel β€” class SliderLabel, type XmString, initial value "Red"
  • rgbFile β€” class String, type String, initial value /usr/share/X11/rgb.txt
  • sliderTogLabel β€” class TogLabel, type XmString, initial value "Color Sliders"
quick lil note so you don't get got: every resource name starts with XmN and every resource class name starts with XmC. periodt. πŸ’…

blueSliderLabel

the string that shows up as the label of the blue slider πŸ¦‹

colorListTogLabel

the string that shows up as the label of the color list toggle

colorMode

the color list can run in either slider mode or list mode. acceptable values are XmListMode and XmScaleMode. this resource is how your app decides which mode the color selector should start in when it gets created. after that? the user can freely flip modes whenever, using a pair of radio buttons inside the color selector. a type converter is registered to convert the strings "ScaleMode" and "ListMode" into color modes, so you can use them straight from the resource database. cute, right? ✨

colorName

this one controls the color name currently displayed to the user. you can set it to change the color shown in the color selector, or query it to find out which color the user actually picked. what you get back is either a color name, or a pound sign (#) followed by a set of rgb values, exactly as specified in the Xlib spec. πŸ’œ

fileReadError

the message shown when the Color Selector can't read the rgb.txt file. it gets displayed at the top of the window where the color list would normally be. sad girl hours 😭

greenSliderLabel

the string that shows up as the label of the green slider πŸ“

marginHeight

marginWidth

this is how much space gets left between each of the children in the color selector, and between the outer children and the edge of the color selector widget itself. breathing room, bestie 🫢

noCellError

this resource controls the message displayed in the sample color field when the Color Selector can't allocate a read/write color cell. 😭

redSliderLabel

the string that shows up as the label of the red slider πŸ”₯

rgbFile

the name of the file to be loaded, which holds the valid color names. every one of those names gets sorted and the duplicates removed before anything is shown to the user. so clean. so organized. we love a dedupe ✨

sliderTogLabel

the string that shows up as the label of the color slider toggle


πŸŽ€ Convenience Routine πŸŽ€

XmCreateColorSelector β€” widget creation convenience routine

Widget XmCreateColorSelector(
     Widget parent,     /* Widget id of parent for ColorSelector */
     String name,       /* Name of the created widget */
     ArgList args,      /* argument list */
     Cardinal num_args  /* number of items in argument list */
     )

🧚 Children 🧚

ngl, the color selector is a whole ensemble cast of sub-widgets. like every widget, most values get passed in through the argument list at creation time or via set values, and they get passed down to each of this widget's children β€” but get values requests have to be made on a child-by-child basis, one at a time. no shortcuts, bestie. 😀

here's the full cast list. go read each child's own documentation for its resource list, iykyk.

  • XmColorSelector<named by application>
    • XmScrolledWindow scrolled
    • XmScrollBarList vScrollBar
    • XmScrollBarList hScrollBar
    • XmList list
    • XmButtonBox buttonBox
    • XmScale scale
    • XmLabelGadget scale_title
    • XmScrollBar scale_scrollbar
    • XmRowColumn radioBox
    • XmToggleButton colorListToggle
    • XmToggleButton colorSlidersToggle
    • XmFrame colorFrame
    • XmLabel colorWindow

Copyright (c) 1992 by Integrated Computer Solutions, Inc.


and that's the whole page, babe πŸ’– this was XmColorSelector(3X), same manual name at the top and the bottom because consistency is iconic, and that copyright is from 1992 β€” truly vintage, truly a classic, we stan a legend 🌟 bye bestie, go pick a pretty color 🌈✨

πŸ“¦ where this page comes from