LaTeXM...:Color(3pm)

✨ NAME ✨

Okay so this is the LaTeXM...:Color(3pm) page, and the main character is LaTeXML::Common::Color — an abstract class representating colors using various color models; it extends LaTeXML::Common::Object. 💅

🎁 Exported functions 🎁

  • $color = Color($model,@components); — creates a Color object using the color model you pass in and the components you give it. The core color models are rgb, hsv, cmy, cmyk and gray. For colors using those core models, the components are between 0 and 1 (inclusive) — yes, both ends count, bestie. 💖
  • Black, White — constant color objects representing black and white, respectively. Literally the main-character constants. 🖤🤍

🛠️ Methods 🛠️

  • $model = $color->model; — returns the name of the color model. Lowkey iconic.
  • @components = $color->components; — returns the components of the color. All of them. 💅
  • $other = $color->convert($tomodel); — converts the color to another color model. Glow-up complete. ✨
  • $string = $color->toString; — returns a printed representation of the color.
  • $hex = $color->toHex; — returns a string representing the color as RGB in hexadecimal, six digits. Six. Periodt. 🎀
  • $other = $color->toCore(); — converts the color to one of the core colors.
  • $complement = $color->complement(); — returns the complement color. This one works for colors in the rgb, cmy and gray color models. 🎨
  • $new = $color->mix($other,$fraction); — returns a new color that results from mixing a $fraction of $color with (1-$fraction) of color $other. Math but make it fashion. 🧮
  • $new = $color->add($other); — returns a new color made by adding the components of the two colors.
  • $new = $color->scale($m); — returns a new color made by multiplying the components by $n. Yes, the signature says $m and the description says $n — that’s the original’s little lore drop, not mine. 💀
  • $new = $color->multiply(@m); — returns a new color made by multiplying the components by the corresponding component from @n. Again: signature @m, description @n. I’m just reporting the group chat. 🙈

👀 SEE ALSO 👀

Supported color models: LaTeXML::Common::Color::rgb, LaTeXML::Common::Color::hsb, LaTeXML::Common::Color::cmy, LaTeXML::Common::Color::cmyk, LaTeXML::Common::Color::gray and LaTeXML::Common::Color::Derived.

💌 AUTHOR 💌

Bruce Miller <bruce.miller@nist.gov> 🫶

Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.


💖 That’s the whole page, bestie — sourced from perl v5.40.1, dated 2025-11-16, and filed under LaTeXM...:Color(3pm). Periodt. 🫶✨

📦 where this page comes from