sandbox
Loading...
Searching...
No Matches
color.hpp File Reference

RGBA color representation and utilities. More...

#include <cmath>
#include <yaml-cpp/yaml.h>
#include <libsbx/utility/hash.hpp>

Go to the source code of this file.

Classes

class  sbx::math::color
 RGBA color value type. More...
 
struct  YAML::convert< sbx::math::color >
 YAML conversion specialization for color. More...
 
struct  std::hash< sbx::math::color >
 Hash specialization for color. More...
 

Namespaces

namespace  libsbx
 

Functions

auto sbx::math::operator== (const color &lhs, const color &rhs) noexcept -> bool
 Equality comparison for colors. More...
 
auto sbx::math::operator* (color lhs, const std::float_t value) -> color
 Scales a color by a scalar factor. More...
 
auto operator<< (YAML::Emitter &out, const sbx::math::color &color) -> YAML::Emitter &
 YAML stream output for color.
 

Detailed Description

RGBA color representation and utilities.

This header defines a lightweight RGBA color class using floating-point components in the range [0, 1]. The type is intended for rendering, serialization, hashing, and general math usage.

The color is stored in linear space and provides convenience constructors, named color factories, component accessors, and interoperability with YAML and hashing utilities.

Author
KAJ

Function Documentation

◆ operator*()

auto sbx::math::operator* ( color  lhs,
const std::float_t  value 
) -> color

Scales a color by a scalar factor.

Parameters
lhsColor to scale.
valueScale factor.
Returns
Scaled color.

◆ operator==()

auto sbx::math::operator== ( const color lhs,
const color rhs 
) -> bool
noexcept

Equality comparison for colors.

Parameters
lhsLeft-hand side color.
rhsRight-hand side color.
Returns
True if all components are equal.