Marmos
v juptune
v asn1
v lang
v ast
v Classes
v Enums
v ir
v parser
v Enums
v Structs
v core
v crypto
v keyexchange
v memory
v data
v alphabet
v buffer
v json
v builder
v parser
v Enums
v Structs
v serialise
v Structs
v Templates
v pem
v Enums
v Structs

Structs AnsiColour

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module juptune.core.util.ansi;

nothrow @safe @nogc struct AnsiColour
{
    /++ FUNCTIONS ++/
    
    /// Assertions: This colour's type must be AnsiColourType.eightBit 
    ubyte asEightBit();
    /// Assertions: This colour's type must be AnsiColourType.fourBit 
    Ansi4BitColour asFourBit();
    /// Assertions: This colour's type must be AnsiColourType.rgb 
    AnsiRgbColour asRgb();
    /// Returns: Whether this AnsiColour is for a background or not (it affects the output!). 
    Flag!("isBg") isBg();
    /// ditto 
    void isBg(Flag!("isBg") bg);
    /// ditto 
    void isBg(bool bg);
    /// Allows direct assignment from any type that can also be used in any of this struct's ctors. 
    auto opAssign(T)(T colour);
    /// OUTPUT 
    char[] toSequence(char[16LU] buffer);
    /// Returns: The AnsiColourType of this AnsiColour . 
    AnsiColourType type();
    
    /++ MANIFEST CONSTANTS ++/
    
    /// The maximum amount of characters any singular AnsiColour sequence may use. 
    enum ulong MAX_CHARS_NEEDED = 16LU;
    
    /++ VARIABLES ++/
    
    /// A variant of .init that is used for background colours. 
    static immutable @safe AnsiColour bgInit;
}

Documentation

Contains any type of ANSI colour and provides the ability to create a valid SGR command to set the foreground/background.

This struct overloads opAssignallowing easy assignment from Ansi4BitColour, Ansi8BitColour, AnsiRgbColour, and any user-defined type that satisfies isUserDefinedRgbType.

CONSTANTS

Constants

Name Description
MAX_CHARS_NEEDED

The maximum amount of characters any singular AnsiColoursequence may use.

Functions

Name Description
asEightBit

Assertions: This colour's type must be AnsiColourType.eightBit

asFourBit

Assertions: This colour's type must be AnsiColourType.fourBit

asRgb

Assertions: This colour's type must be AnsiColourType.rgb

isBg

Returns: Whether this AnsiColouris for a background or not (it affects the output!).

isBg

ditto

isBg

ditto

opAssign

Allows direct assignment from any type that can also be used in any of this struct's ctors.

toSequence

OUTPUT

type

Returns: The AnsiColourTypeof this AnsiColour.

Variables

Name Description
bgInit

A variant of .initthat is used for background colours.