libtcod
Loading...
Searching...
No Matches
color.hpp
Go to the documentation of this file.
1/* BSD 3-Clause License
2 *
3 * Copyright © 2008-2026, Jice and the libtcod contributors.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3. Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
34#pragma once
35#ifndef TCOD_COLOR_HPP_
36#define TCOD_COLOR_HPP_
37
38#include <algorithm>
39#include <array>
40#include <stdexcept>
41
42#include "color.h"
43#include "utility.h"
44
45namespace tcod {
46
51struct ColorRGB : public TCOD_ColorRGB {
52 public:
53
56 constexpr ColorRGB() noexcept : ColorRGB{0, 0, 0} {}
57
60 constexpr ColorRGB(uint8_t red, uint8_t green, uint8_t blue) noexcept : TCOD_ColorRGB{red, green, blue} {}
61
64 explicit constexpr ColorRGB(const TCOD_ColorRGB& rhs) noexcept : TCOD_ColorRGB{rhs} {}
65
68 explicit constexpr ColorRGB(const TCOD_ColorRGBA& rhs) noexcept : ColorRGB{rhs.r, rhs.g, rhs.b} {}
69
72 [[nodiscard]] constexpr operator const TCOD_ColorRGBA() const noexcept { return TCOD_ColorRGBA{r, g, b, 255}; }
73
76 [[nodiscard]] constexpr explicit operator TCOD_ColorRGB*() noexcept { return this; }
77
80 [[nodiscard]] constexpr explicit operator const TCOD_ColorRGB*() const noexcept { return this; }
81};
82
87struct ColorRGBA : public TCOD_ColorRGBA {
88 public:
89
92 constexpr ColorRGBA() noexcept : ColorRGBA{0, 0, 0, 255} {}
93
96 constexpr ColorRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255) noexcept
97 : TCOD_ColorRGBA{red, green, blue, alpha} {}
98
101 explicit constexpr ColorRGBA(const TCOD_ColorRGB& rhs, uint8_t alpha = 255) noexcept
102 : TCOD_ColorRGBA{rhs.r, rhs.b, rhs.b, alpha} {}
103
106 explicit constexpr ColorRGBA(const TCOD_ColorRGBA& rhs) noexcept : TCOD_ColorRGBA{rhs} {}
107
110 [[nodiscard]] constexpr explicit operator TCOD_ColorRGB() const noexcept { return TCOD_ColorRGB{r, g, b}; };
111
114 [[nodiscard]] constexpr explicit operator TCOD_ColorRGBA*() noexcept { return this; }
115
118 [[nodiscard]] constexpr explicit operator const TCOD_ColorRGBA*() const noexcept { return this; }
119};
120} // namespace tcod
121// clang-format off
122// color constants uses to generate @ColorTable
161
216
217class TCODLIB_API TCODColor {
218public:
219 constexpr TCODColor() noexcept = default;
236 constexpr TCODColor(uint8_t r_, uint8_t g_, uint8_t b_) noexcept
237 : r{r_}, g{g_}, b{b_}
238 {}
239 constexpr TCODColor(int r_, int g_, int b_) noexcept
240 : r{static_cast<uint8_t>(r_)}, g{static_cast<uint8_t>(g_)}, b{static_cast<uint8_t>(b_)}
241 {}
242 constexpr TCODColor(const TCOD_color_t &col) noexcept: r{col.r}, g{col.g}, b{col.b} {} // Notice: not explicit!
243 TCODColor(float h, float s, float v) noexcept;
244
263 [[nodiscard]] constexpr bool operator==(const TCODColor& c) const noexcept
264 {
265 return (c.r == r && c.g == g && c.b == b);
266 }
267 [[nodiscard]] constexpr bool operator!=(const TCODColor& c) const noexcept
268 {
269 return !(*this == c);
270 }
271
287 [[nodiscard]] constexpr TCODColor operator*(const TCODColor& rhs) const noexcept
288 {
289 return TCODColor{
290 r * rhs.r / 255,
291 g * rhs.g / 255,
292 b * rhs.b / 255,
293 };
294 }
295
312 [[nodiscard]] constexpr TCODColor operator*(float value) const noexcept
313 {
314 return TCODColor{
315 static_cast<uint8_t>(std::clamp(r * value, 0.0f, 255.0f)),
316 static_cast<uint8_t>(std::clamp(g * value, 0.0f, 255.0f)),
317 static_cast<uint8_t>(std::clamp(b * value, 0.0f, 255.0f)),
318 };
319 }
320 [[nodiscard]] TCODLIB_API_INLINE_EXPORT friend TCODColor operator*(float value, const TCODColor& color) noexcept {
321 return color * value;
322 }
323
338 [[nodiscard]] constexpr TCODColor operator+(const TCODColor & rhs) const noexcept
339 {
340 return TCODColor{
341 std::clamp(r + rhs.r, 0, 255),
342 std::clamp(g + rhs.g, 0, 255),
343 std::clamp(b + rhs.b, 0, 255),
344 };
345 }
346
361 [[nodiscard]] constexpr TCODColor operator-(const TCODColor& rhs) const noexcept
362 {
363 return TCODColor{
364 std::clamp(r - rhs.r, 0, 255),
365 std::clamp(g - rhs.g, 0, 255),
366 std::clamp(b - rhs.b, 0, 255),
367 };
368 }
369
389 [[nodiscard]] static constexpr TCODColor lerp(const TCODColor &c1, const TCODColor &c2, float coef) noexcept
390 {
391 return TCODColor{
392 c1.r + static_cast<int>((c2.r - c1.r) * coef),
393 c1.g + static_cast<int>((c2.g - c1.g) * coef),
394 c1.b + static_cast<int>((c2.b - c1.b) * coef),
395 };
396 }
397
413 void setHSV(float h, float s, float v) noexcept;
414
434 void setHue(float h) noexcept;
435 void setSaturation(float s) noexcept;
436 void setValue(float v) noexcept;
437
452 void getHSV(float *h, float *s, float *v) const noexcept;
453
476 [[nodiscard]] float getHue() noexcept;
477 [[nodiscard]] float getSaturation() noexcept;
478 [[nodiscard]] float getValue() noexcept;
479
492 void shiftHue(float hshift) noexcept;
493
506 void scaleHSV(float sscale, float vscale) noexcept;
507
552 static void genMap(TCODColor *map, int nbKey, TCODColor const *keyColor, int const *keyIndex);
553 // clang-format on
554
555
580 template <int OutSize, typename KeyColors, typename KeyIndexes>
581 [[nodiscard]] static constexpr auto genMap(const KeyColors& key_colors, const KeyIndexes& key_indexes)
582 -> std::array<tcod::ColorRGB, OutSize> {
583 auto out = std::array<tcod::ColorRGB, OutSize>{};
584 if (key_colors.size() != key_indexes.size())
585 throw std::invalid_argument{"Key color and index arrays must be the same size."};
586 for (size_t segment = 1; segment < key_colors.size(); ++segment) { // Segment between two key colors/indexes.
587 const auto index_start = key_indexes.at(segment - 1);
588 const auto index_end = key_indexes.at(segment);
589 if (segment == 1 && index_start != 0) throw std::invalid_argument{"First key must be 0."};
590 if (segment == key_colors.size() - 1 && index_end != OutSize - 1) {
591 throw std::invalid_argument{"Last key must be at the end of the output size."};
592 }
593 if (!(index_start < index_end)) throw std::invalid_argument{"Key indexes must be in ascending order."};
594 const auto color_start = TCODColor{key_colors.at(segment - 1)};
595 const auto color_end = TCODColor{key_colors.at(segment)};
596 for (auto i = index_start; i <= index_end; ++i) {
597 const float interpolation = static_cast<float>(i - index_start) / (index_end - index_start);
598 out.at(i) = tcod::ColorRGB{TCODColor::lerp(color_start, color_end, interpolation)};
599 }
600 }
601 return out;
602 }
603
604
610 [[nodiscard]] constexpr explicit operator TCOD_ColorRGB() const noexcept { return {r, g, b}; }
611
617 [[nodiscard]] constexpr explicit operator TCOD_ColorRGBA() const noexcept { return {r, g, b, 255}; }
618
624 [[nodiscard]] constexpr explicit operator tcod::ColorRGB() const noexcept { return {r, g, b}; };
625
631 [[nodiscard]] constexpr explicit operator tcod::ColorRGBA() const noexcept { return {r, g, b, 255}; };
632
634 // color array
635 static const TCODColor colors [[deprecated]][TCOD_COLOR_NB][TCOD_COLOR_LEVELS];
636
637 // grey levels
638 static const TCODColor black [[deprecated("Replace with tcod::ColorRGB{0, 0, 0}")]];
639 static const TCODColor darkestGrey [[deprecated("Replace with tcod::ColorRGB{31, 31, 31}")]];
640 static const TCODColor darkerGrey [[deprecated("Replace with tcod::ColorRGB{63, 63, 63}")]];
641 static const TCODColor darkGrey [[deprecated("Replace with tcod::ColorRGB{95, 95, 95}")]];
642 static const TCODColor grey [[deprecated("Replace with tcod::ColorRGB{127, 127, 127}")]];
643 static const TCODColor lightGrey [[deprecated("Replace with tcod::ColorRGB{159, 159, 159}")]];
644 static const TCODColor lighterGrey [[deprecated("Replace with tcod::ColorRGB{191, 191, 191}")]];
645 static const TCODColor lightestGrey [[deprecated("Replace with tcod::ColorRGB{223, 223, 223}")]];
646 static const TCODColor white [[deprecated("Replace with tcod::ColorRGB{255, 255, 255}")]];
647
648 // sepia
649 static const TCODColor darkestSepia [[deprecated("Replace with tcod::ColorRGB{31, 24, 15}")]];
650 static const TCODColor darkerSepia [[deprecated("Replace with tcod::ColorRGB{63, 50, 31}")]];
651 static const TCODColor darkSepia [[deprecated("Replace with tcod::ColorRGB{94, 75, 47}")]];
652 static const TCODColor sepia [[deprecated("Replace with tcod::ColorRGB{127, 101, 63}")]];
653 static const TCODColor lightSepia [[deprecated("Replace with tcod::ColorRGB{158, 134, 100}")]];
654 static const TCODColor lighterSepia [[deprecated("Replace with tcod::ColorRGB{191, 171, 143}")]];
655 static const TCODColor lightestSepia [[deprecated("Replace with tcod::ColorRGB{222, 211, 195}")]];
656
657 // standard colors
658 static const TCODColor red [[deprecated("Replace with tcod::ColorRGB{255, 0, 0}")]];
659 static const TCODColor flame [[deprecated("Replace with tcod::ColorRGB{255, 63, 0}")]];
660 static const TCODColor orange [[deprecated("Replace with tcod::ColorRGB{255, 127, 0}")]];
661 static const TCODColor amber [[deprecated("Replace with tcod::ColorRGB{255, 191, 0}")]];
662 static const TCODColor yellow [[deprecated("Replace with tcod::ColorRGB{255, 255, 0}")]];
663 static const TCODColor lime [[deprecated("Replace with tcod::ColorRGB{191, 255, 0}")]];
664 static const TCODColor chartreuse [[deprecated("Replace with tcod::ColorRGB{127, 255, 0}")]];
665 static const TCODColor green [[deprecated("Replace with tcod::ColorRGB{0, 255, 0}")]];
666 static const TCODColor sea [[deprecated("Replace with tcod::ColorRGB{0, 255, 127}")]];
667 static const TCODColor turquoise [[deprecated("Replace with tcod::ColorRGB{0, 255, 191}")]];
668 static const TCODColor cyan [[deprecated("Replace with tcod::ColorRGB{0, 255, 255}")]];
669 static const TCODColor sky [[deprecated("Replace with tcod::ColorRGB{0, 191, 255}")]];
670 static const TCODColor azure [[deprecated("Replace with tcod::ColorRGB{0, 127, 255}")]];
671 static const TCODColor blue [[deprecated("Replace with tcod::ColorRGB{0, 0, 255}")]];
672 static const TCODColor han [[deprecated("Replace with tcod::ColorRGB{63, 0, 255}")]];
673 static const TCODColor violet [[deprecated("Replace with tcod::ColorRGB{127, 0, 255}")]];
674 static const TCODColor purple [[deprecated("Replace with tcod::ColorRGB{191, 0, 255}")]];
675 static const TCODColor fuchsia [[deprecated("Replace with tcod::ColorRGB{255, 0, 255}")]];
676 static const TCODColor magenta [[deprecated("Replace with tcod::ColorRGB{255, 0, 191}")]];
677 static const TCODColor pink [[deprecated("Replace with tcod::ColorRGB{255, 0, 127}")]];
678 static const TCODColor crimson [[deprecated("Replace with tcod::ColorRGB{255, 0, 63}")]];
679
680 // dark colors
681 static const TCODColor darkRed [[deprecated("Replace with tcod::ColorRGB{191, 0, 0}")]];
682 static const TCODColor darkFlame [[deprecated("Replace with tcod::ColorRGB{191, 47, 0}")]];
683 static const TCODColor darkOrange [[deprecated("Replace with tcod::ColorRGB{191, 95, 0}")]];
684 static const TCODColor darkAmber [[deprecated("Replace with tcod::ColorRGB{191, 143, 0}")]];
685 static const TCODColor darkYellow [[deprecated("Replace with tcod::ColorRGB{191, 191, 0}")]];
686 static const TCODColor darkLime [[deprecated("Replace with tcod::ColorRGB{143, 191, 0}")]];
687 static const TCODColor darkChartreuse [[deprecated("Replace with tcod::ColorRGB{95, 191, 0}")]];
688 static const TCODColor darkGreen [[deprecated("Replace with tcod::ColorRGB{0, 191, 0}")]];
689 static const TCODColor darkSea [[deprecated("Replace with tcod::ColorRGB{0, 191, 95}")]];
690 static const TCODColor darkTurquoise [[deprecated("Replace with tcod::ColorRGB{0, 191, 143}")]];
691 static const TCODColor darkCyan [[deprecated("Replace with tcod::ColorRGB{0, 191, 191}")]];
692 static const TCODColor darkSky [[deprecated("Replace with tcod::ColorRGB{0, 143, 191}")]];
693 static const TCODColor darkAzure [[deprecated("Replace with tcod::ColorRGB{0, 95, 191}")]];
694 static const TCODColor darkBlue [[deprecated("Replace with tcod::ColorRGB{0, 0, 191}")]];
695 static const TCODColor darkHan [[deprecated("Replace with tcod::ColorRGB{47, 0, 191}")]];
696 static const TCODColor darkViolet [[deprecated("Replace with tcod::ColorRGB{95, 0, 191}")]];
697 static const TCODColor darkPurple [[deprecated("Replace with tcod::ColorRGB{143, 0, 191}")]];
698 static const TCODColor darkFuchsia [[deprecated("Replace with tcod::ColorRGB{191, 0, 191}")]];
699 static const TCODColor darkMagenta [[deprecated("Replace with tcod::ColorRGB{191, 0, 143}")]];
700 static const TCODColor darkPink [[deprecated("Replace with tcod::ColorRGB{191, 0, 95}")]];
701 static const TCODColor darkCrimson [[deprecated("Replace with tcod::ColorRGB{191, 0, 47}")]];
702
703 // darker colors
704 static const TCODColor darkerRed [[deprecated("Replace with tcod::ColorRGB{127, 0, 0}")]];
705 static const TCODColor darkerFlame [[deprecated("Replace with tcod::ColorRGB{127, 31, 0}")]];
706 static const TCODColor darkerOrange [[deprecated("Replace with tcod::ColorRGB{127, 63, 0}")]];
707 static const TCODColor darkerAmber [[deprecated("Replace with tcod::ColorRGB{127, 95, 0}")]];
708 static const TCODColor darkerYellow [[deprecated("Replace with tcod::ColorRGB{127, 127, 0}")]];
709 static const TCODColor darkerLime [[deprecated("Replace with tcod::ColorRGB{95, 127, 0}")]];
710 static const TCODColor darkerChartreuse [[deprecated("Replace with tcod::ColorRGB{63, 127, 0}")]];
711 static const TCODColor darkerGreen [[deprecated("Replace with tcod::ColorRGB{0, 127, 0}")]];
712 static const TCODColor darkerSea [[deprecated("Replace with tcod::ColorRGB{0, 127, 63}")]];
713 static const TCODColor darkerTurquoise [[deprecated("Replace with tcod::ColorRGB{0, 127, 95}")]];
714 static const TCODColor darkerCyan [[deprecated("Replace with tcod::ColorRGB{0, 127, 127}")]];
715 static const TCODColor darkerSky [[deprecated("Replace with tcod::ColorRGB{0, 95, 127}")]];
716 static const TCODColor darkerAzure [[deprecated("Replace with tcod::ColorRGB{0, 63, 127}")]];
717 static const TCODColor darkerBlue [[deprecated("Replace with tcod::ColorRGB{0, 0, 127}")]];
718 static const TCODColor darkerHan [[deprecated("Replace with tcod::ColorRGB{31, 0, 127}")]];
719 static const TCODColor darkerViolet [[deprecated("Replace with tcod::ColorRGB{63, 0, 127}")]];
720 static const TCODColor darkerPurple [[deprecated("Replace with tcod::ColorRGB{95, 0, 127}")]];
721 static const TCODColor darkerFuchsia [[deprecated("Replace with tcod::ColorRGB{127, 0, 127}")]];
722 static const TCODColor darkerMagenta [[deprecated("Replace with tcod::ColorRGB{127, 0, 95}")]];
723 static const TCODColor darkerPink [[deprecated("Replace with tcod::ColorRGB{127, 0, 63}")]];
724 static const TCODColor darkerCrimson [[deprecated("Replace with tcod::ColorRGB{127, 0, 31}")]];
725
726 // darkest colors
727 static const TCODColor darkestRed [[deprecated("Replace with tcod::ColorRGB{63, 0, 0}")]];
728 static const TCODColor darkestFlame [[deprecated("Replace with tcod::ColorRGB{63, 15, 0}")]];
729 static const TCODColor darkestOrange [[deprecated("Replace with tcod::ColorRGB{63, 31, 0}")]];
730 static const TCODColor darkestAmber [[deprecated("Replace with tcod::ColorRGB{63, 47, 0}")]];
731 static const TCODColor darkestYellow [[deprecated("Replace with tcod::ColorRGB{63, 63, 0}")]];
732 static const TCODColor darkestLime [[deprecated("Replace with tcod::ColorRGB{47, 63, 0}")]];
733 static const TCODColor darkestChartreuse [[deprecated("Replace with tcod::ColorRGB{31, 63, 0}")]];
734 static const TCODColor darkestGreen [[deprecated("Replace with tcod::ColorRGB{0, 63, 0}")]];
735 static const TCODColor darkestSea [[deprecated("Replace with tcod::ColorRGB{0, 63, 31}")]];
736 static const TCODColor darkestTurquoise [[deprecated("Replace with tcod::ColorRGB{0, 63, 47}")]];
737 static const TCODColor darkestCyan [[deprecated("Replace with tcod::ColorRGB{0, 63, 63}")]];
738 static const TCODColor darkestSky [[deprecated("Replace with tcod::ColorRGB{0, 47, 63}")]];
739 static const TCODColor darkestAzure [[deprecated("Replace with tcod::ColorRGB{0, 31, 63}")]];
740 static const TCODColor darkestBlue [[deprecated("Replace with tcod::ColorRGB{0, 0, 63}")]];
741 static const TCODColor darkestHan [[deprecated("Replace with tcod::ColorRGB{15, 0, 63}")]];
742 static const TCODColor darkestViolet [[deprecated("Replace with tcod::ColorRGB{31, 0, 63}")]];
743 static const TCODColor darkestPurple [[deprecated("Replace with tcod::ColorRGB{47, 0, 63}")]];
744 static const TCODColor darkestFuchsia [[deprecated("Replace with tcod::ColorRGB{63, 0, 63}")]];
745 static const TCODColor darkestMagenta [[deprecated("Replace with tcod::ColorRGB{63, 0, 47}")]];
746 static const TCODColor darkestPink [[deprecated("Replace with tcod::ColorRGB{63, 0, 31}")]];
747 static const TCODColor darkestCrimson [[deprecated("Replace with tcod::ColorRGB{63, 0, 15}")]];
748
749 // light colors
750 static const TCODColor lightRed [[deprecated("Replace with tcod::ColorRGB{255, 63, 63}")]];
751 static const TCODColor lightFlame [[deprecated("Replace with tcod::ColorRGB{255, 111, 63}")]];
752 static const TCODColor lightOrange [[deprecated("Replace with tcod::ColorRGB{255, 159, 63}")]];
753 static const TCODColor lightAmber [[deprecated("Replace with tcod::ColorRGB{255, 207, 63}")]];
754 static const TCODColor lightYellow [[deprecated("Replace with tcod::ColorRGB{255, 255, 63}")]];
755 static const TCODColor lightLime [[deprecated("Replace with tcod::ColorRGB{207, 255, 63}")]];
756 static const TCODColor lightChartreuse [[deprecated("Replace with tcod::ColorRGB{159, 255, 63}")]];
757 static const TCODColor lightGreen [[deprecated("Replace with tcod::ColorRGB{63, 255, 63}")]];
758 static const TCODColor lightSea [[deprecated("Replace with tcod::ColorRGB{63, 255, 159}")]];
759 static const TCODColor lightTurquoise [[deprecated("Replace with tcod::ColorRGB{63, 255, 207}")]];
760 static const TCODColor lightCyan [[deprecated("Replace with tcod::ColorRGB{63, 255, 255}")]];
761 static const TCODColor lightSky [[deprecated("Replace with tcod::ColorRGB{63, 207, 255}")]];
762 static const TCODColor lightAzure [[deprecated("Replace with tcod::ColorRGB{63, 159, 255}")]];
763 static const TCODColor lightBlue [[deprecated("Replace with tcod::ColorRGB{63, 63, 255}")]];
764 static const TCODColor lightHan [[deprecated("Replace with tcod::ColorRGB{111, 63, 255}")]];
765 static const TCODColor lightViolet [[deprecated("Replace with tcod::ColorRGB{159, 63, 255}")]];
766 static const TCODColor lightPurple [[deprecated("Replace with tcod::ColorRGB{207, 63, 255}")]];
767 static const TCODColor lightFuchsia [[deprecated("Replace with tcod::ColorRGB{255, 63, 255}")]];
768 static const TCODColor lightMagenta [[deprecated("Replace with tcod::ColorRGB{255, 63, 207}")]];
769 static const TCODColor lightPink [[deprecated("Replace with tcod::ColorRGB{255, 63, 159}")]];
770 static const TCODColor lightCrimson [[deprecated("Replace with tcod::ColorRGB{255, 63, 111}")]];
771
772 // lighter colors
773 static const TCODColor lighterRed [[deprecated("Replace with tcod::ColorRGB{255, 127, 127}")]];
774 static const TCODColor lighterFlame [[deprecated("Replace with tcod::ColorRGB{255, 159, 127}")]];
775 static const TCODColor lighterOrange [[deprecated("Replace with tcod::ColorRGB{255, 191, 127}")]];
776 static const TCODColor lighterAmber [[deprecated("Replace with tcod::ColorRGB{255, 223, 127}")]];
777 static const TCODColor lighterYellow [[deprecated("Replace with tcod::ColorRGB{255, 255, 127}")]];
778 static const TCODColor lighterLime [[deprecated("Replace with tcod::ColorRGB{223, 255, 127}")]];
779 static const TCODColor lighterChartreuse [[deprecated("Replace with tcod::ColorRGB{191, 255, 127}")]];
780 static const TCODColor lighterGreen [[deprecated("Replace with tcod::ColorRGB{127, 255, 127}")]];
781 static const TCODColor lighterSea [[deprecated("Replace with tcod::ColorRGB{127, 255, 191}")]];
782 static const TCODColor lighterTurquoise [[deprecated("Replace with tcod::ColorRGB{127, 255, 223}")]];
783 static const TCODColor lighterCyan [[deprecated("Replace with tcod::ColorRGB{127, 255, 255}")]];
784 static const TCODColor lighterSky [[deprecated("Replace with tcod::ColorRGB{127, 223, 255}")]];
785 static const TCODColor lighterAzure [[deprecated("Replace with tcod::ColorRGB{127, 191, 255}")]];
786 static const TCODColor lighterBlue [[deprecated("Replace with tcod::ColorRGB{127, 127, 255}")]];
787 static const TCODColor lighterHan [[deprecated("Replace with tcod::ColorRGB{159, 127, 255}")]];
788 static const TCODColor lighterViolet [[deprecated("Replace with tcod::ColorRGB{191, 127, 255}")]];
789 static const TCODColor lighterPurple [[deprecated("Replace with tcod::ColorRGB{223, 127, 255}")]];
790 static const TCODColor lighterFuchsia [[deprecated("Replace with tcod::ColorRGB{255, 127, 255}")]];
791 static const TCODColor lighterMagenta [[deprecated("Replace with tcod::ColorRGB{255, 127, 223}")]];
792 static const TCODColor lighterPink [[deprecated("Replace with tcod::ColorRGB{255, 127, 191}")]];
793 static const TCODColor lighterCrimson [[deprecated("Replace with tcod::ColorRGB{255, 127, 159}")]];
794
795 // lightest colors
796 static const TCODColor lightestRed [[deprecated("Replace with tcod::ColorRGB{255, 191, 191}")]];
797 static const TCODColor lightestFlame [[deprecated("Replace with tcod::ColorRGB{255, 207, 191}")]];
798 static const TCODColor lightestOrange [[deprecated("Replace with tcod::ColorRGB{255, 223, 191}")]];
799 static const TCODColor lightestAmber [[deprecated("Replace with tcod::ColorRGB{255, 239, 191}")]];
800 static const TCODColor lightestYellow [[deprecated("Replace with tcod::ColorRGB{255, 255, 191}")]];
801 static const TCODColor lightestLime [[deprecated("Replace with tcod::ColorRGB{239, 255, 191}")]];
802 static const TCODColor lightestChartreuse [[deprecated("Replace with tcod::ColorRGB{223, 255, 191}")]];
803 static const TCODColor lightestGreen [[deprecated("Replace with tcod::ColorRGB{191, 255, 191}")]];
804 static const TCODColor lightestSea [[deprecated("Replace with tcod::ColorRGB{191, 255, 223}")]];
805 static const TCODColor lightestTurquoise [[deprecated("Replace with tcod::ColorRGB{191, 255, 239}")]];
806 static const TCODColor lightestCyan [[deprecated("Replace with tcod::ColorRGB{191, 255, 255}")]];
807 static const TCODColor lightestSky [[deprecated("Replace with tcod::ColorRGB{191, 239, 255}")]];
808 static const TCODColor lightestAzure [[deprecated("Replace with tcod::ColorRGB{191, 223, 255}")]];
809 static const TCODColor lightestBlue [[deprecated("Replace with tcod::ColorRGB{191, 191, 255}")]];
810 static const TCODColor lightestHan [[deprecated("Replace with tcod::ColorRGB{207, 191, 255}")]];
811 static const TCODColor lightestViolet [[deprecated("Replace with tcod::ColorRGB{223, 191, 255}")]];
812 static const TCODColor lightestPurple [[deprecated("Replace with tcod::ColorRGB{239, 191, 255}")]];
813 static const TCODColor lightestFuchsia [[deprecated("Replace with tcod::ColorRGB{255, 191, 255}")]];
814 static const TCODColor lightestMagenta [[deprecated("Replace with tcod::ColorRGB{255, 191, 239}")]];
815 static const TCODColor lightestPink [[deprecated("Replace with tcod::ColorRGB{255, 191, 223}")]];
816 static const TCODColor lightestCrimson [[deprecated("Replace with tcod::ColorRGB{255, 191, 207}")]];
817
818 // desaturated colors
819 static const TCODColor desaturatedRed [[deprecated("Replace with tcod::ColorRGB{127, 63, 63}")]];
820 static const TCODColor desaturatedFlame [[deprecated("Replace with tcod::ColorRGB{127, 79, 63}")]];
821 static const TCODColor desaturatedOrange [[deprecated("Replace with tcod::ColorRGB{127, 95, 63}")]];
822 static const TCODColor desaturatedAmber [[deprecated("Replace with tcod::ColorRGB{127, 111, 63}")]];
823 static const TCODColor desaturatedYellow [[deprecated("Replace with tcod::ColorRGB{127, 127, 63}")]];
824 static const TCODColor desaturatedLime [[deprecated("Replace with tcod::ColorRGB{111, 127, 63}")]];
825 static const TCODColor desaturatedChartreuse [[deprecated("Replace with tcod::ColorRGB{95, 127, 63}")]];
826 static const TCODColor desaturatedGreen [[deprecated("Replace with tcod::ColorRGB{63, 127, 63}")]];
827 static const TCODColor desaturatedSea [[deprecated("Replace with tcod::ColorRGB{63, 127, 95}")]];
828 static const TCODColor desaturatedTurquoise [[deprecated("Replace with tcod::ColorRGB{63, 127, 111}")]];
829 static const TCODColor desaturatedCyan [[deprecated("Replace with tcod::ColorRGB{63, 127, 127}")]];
830 static const TCODColor desaturatedSky [[deprecated("Replace with tcod::ColorRGB{63, 111, 127}")]];
831 static const TCODColor desaturatedAzure [[deprecated("Replace with tcod::ColorRGB{63, 95, 127}")]];
832 static const TCODColor desaturatedBlue [[deprecated("Replace with tcod::ColorRGB{63, 63, 127}")]];
833 static const TCODColor desaturatedHan [[deprecated("Replace with tcod::ColorRGB{79, 63, 127}")]];
834 static const TCODColor desaturatedViolet [[deprecated("Replace with tcod::ColorRGB{95, 63, 127}")]];
835 static const TCODColor desaturatedPurple [[deprecated("Replace with tcod::ColorRGB{111, 63, 127}")]];
836 static const TCODColor desaturatedFuchsia [[deprecated("Replace with tcod::ColorRGB{127, 63, 127}")]];
837 static const TCODColor desaturatedMagenta [[deprecated("Replace with tcod::ColorRGB{127, 63, 111}")]];
838 static const TCODColor desaturatedPink [[deprecated("Replace with tcod::ColorRGB{127, 63, 95}")]];
839 static const TCODColor desaturatedCrimson [[deprecated("Replace with tcod::ColorRGB{127, 63, 79}")]];
840
841 // metallic
842 static const TCODColor brass [[deprecated("Replace with tcod::ColorRGB{191, 151, 96}")]];
843 static const TCODColor copper [[deprecated("Replace with tcod::ColorRGB{197, 136, 124}")]];
844 static const TCODColor gold [[deprecated("Replace with tcod::ColorRGB{229, 191, 0}")]];
845 static const TCODColor silver [[deprecated("Replace with tcod::ColorRGB{203, 203, 203}")]];
846
847 // miscellaneous
848 static const TCODColor celadon [[deprecated("Replace with tcod::ColorRGB{172, 255, 175}")]];
849 static const TCODColor peach [[deprecated("Replace with tcod::ColorRGB{255, 159, 127}")]];
851
852 uint8_t r{};
853 uint8_t g{};
854 uint8_t b{};
855
856 private:
857};
858#endif // TCOD_COLOR_HPP_
Color handling module.
The libtcod namespace.
Definition color.hpp:45
A 4-channel RGBA color struct.
Definition color.h:89
A 3-channel RGB color struct.
Definition color.h:48
constexpr ColorRGBA() noexcept
Default construct a black ColorRGBA object.
Definition color.hpp:92
constexpr ColorRGBA(const TCOD_ColorRGBA &rhs) noexcept
Construct a ColorRGBA object from an TCOD_ColorRGBA struct.
Definition color.hpp:106
constexpr ColorRGBA(const TCOD_ColorRGB &rhs, uint8_t alpha=255) noexcept
Construct a ColorRGBA object by adding an alpha channel to an RGB object.
Definition color.hpp:101
constexpr ColorRGBA(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha=255) noexcept
Construct a ColorRGBA object with the provided color and alpha.
Definition color.hpp:96
constexpr ColorRGB(const TCOD_ColorRGB &rhs) noexcept
Construct a ColorRGB object from an TCOD_ColorRGB struct.
Definition color.hpp:64
constexpr ColorRGB(const TCOD_ColorRGBA &rhs) noexcept
Construct a ColorRGB object from an RGBA color, truncating the alpha.
Definition color.hpp:68
constexpr ColorRGB() noexcept
Default construct a black ColorRGB object.
Definition color.hpp:56
constexpr ColorRGB(uint8_t red, uint8_t green, uint8_t blue) noexcept
Construct a ColorRGB object with the provided color.
Definition color.hpp:60
Common C macro definitions.