Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
color_utils.hpp File Reference

Compile-time colour helpers: packed ImU32 colours from RGB components or "#rrggbb" strings. More...

#include "imgui.h"
Include dependency graph for color_utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  sham
 namespace for backends this one is named only sham since shambackends is too long to write

Functions

constexpr int sham::gui::hexv (char c)
 Value of one hexadecimal digit ('0'-'9', 'a'-'f' or 'A'-'F').
constexpr ImU32 sham::gui::rgb_u32 (int r, int g, int b, int a=255)
 Pack 8-bit components into an ImU32 (ImGui's IM_COL32 layout).
constexpr ImU32 sham::gui::rgba (const char *h, double a=1.0)
 Colour from a "#rrggbb" string, with alpha a in [0, 1].

Detailed Description

Compile-time colour helpers: packed ImU32 colours from RGB components or "#rrggbb" strings.

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition in file color_utils.hpp.

Function Documentation

◆ hexv()

int sham::gui::hexv ( char c)
constexpr

Value of one hexadecimal digit ('0'-'9', 'a'-'f' or 'A'-'F').

Definition at line 25 of file color_utils.hpp.

◆ rgb_u32()

ImU32 sham::gui::rgb_u32 ( int r,
int g,
int b,
int a = 255 )
constexpr

Pack 8-bit components into an ImU32 (ImGui's IM_COL32 layout).

Definition at line 28 of file color_utils.hpp.

◆ rgba()

ImU32 sham::gui::rgba ( const char * h,
double a = 1.0 )
constexpr

Colour from a "#rrggbb" string, with alpha a in [0, 1].

Definition at line 33 of file color_utils.hpp.