aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
std::formatter< Color > Struct Template Reference

Formats a color as TYPE(ch1, ch2, ch3, alpha). More...

Public Member Functions

constexpr auto parse (std::format_parse_context &ctx)
 Parse the spec that every channel is formatted with.
auto format (const Color &color, std::format_context &ctx) const
 Write the formatted color to the output of ctx.

Private Attributes

std::formatter< float > _channel
 Formatter for each channel, set by a non-empty spec.
bool _useDefault = true
 Whether the spec was empty, printing three decimals.

Detailed Description

template<aest::colors::ColorType Color>
struct std::formatter< Color >

Formats a color as TYPE(ch1, ch2, ch3, alpha).

The format spec is a floating-point spec applied to every channel, so {:.1f} prints one decimal each; an empty spec prints three decimals.

Template Parameters
ColorThe color type to format

Definition at line 25 of file Format.cppm.

Member Function Documentation

◆ format()

template<aest::colors::ColorType Color>
auto std::formatter< Color >::format ( const Color & color,
std::format_context & ctx ) const
inline

Write the formatted color to the output of ctx.

Parameters
[in]colorThe color to format
[in,out]ctxThe format context to write to
Returns
The output iterator past the written characters.

Definition at line 44 of file Format.cppm.

◆ parse()

template<aest::colors::ColorType Color>
auto std::formatter< Color >::parse ( std::format_parse_context & ctx)
inlineconstexpr

Parse the spec that every channel is formatted with.

Parameters
[in,out]ctxThe parse context, positioned at the spec
Returns
The iterator past the parsed spec.

Definition at line 32 of file Format.cppm.

Member Data Documentation

◆ _channel

template<aest::colors::ColorType Color>
std::formatter<float> std::formatter< Color >::_channel
private

Formatter for each channel, set by a non-empty spec.

Definition at line 67 of file Format.cppm.

◆ _useDefault

template<aest::colors::ColorType Color>
bool std::formatter< Color >::_useDefault = true
private

Whether the spec was empty, printing three decimals.

Definition at line 68 of file Format.cppm.


The documentation for this struct was generated from the following file: