libsir 2.2.6
Standard Incident Reporter
Loading...
Searching...
No Matches
ansimacros.h File Reference

ANSI escape sequence macros. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SIR_ESC   "\x1b["
 Begins an ANSI escape sequence.
 
#define SIR_ESC_M   "m"
 Marks the end of a sequence.
 
#define SIR_ESC_RST   SIR_ESC_SEQE("0")
 Resets all previously applied colors and effects/attributes.
 
#define SIR_R_ARROW   "\xe2\x86\x92"
 A few fun characters.
 
#define SIR_COLOR(attr, fg, bg, s)
 Creates a sequence of colored characters 's' with foreground color 'fg', background color 'bg', and attributes 'attr' (0=normal, 1=bold, 2=dim, 3=italic, 4=underlined, 5=blinking, 7=inverted, 9=strikethrough).
 
#define SIR_STRIKE(s)
 Strike-through.
 
#define SIR_INVERT(s)
 Inverted fg/bg.
 
#define SIR_ULINE(s)
 Underlined.
 
#define SIR_EMPH(s)
 Emphasis/italic.
 
#define SIR_BOLD(s)
 Bold.
 
#define SIR_BLINK(s)
 Blinking text.
 
#define SIR_BLACK(s)
 Black foreground text.
 
#define SIR_BLACKB(s)
 Bold black foreground text.
 
#define SIR_RED(s)
 Red foreground text.
 
#define SIR_REDB(s)
 Bold red foreground text.
 
#define SIR_BRED(s)
 Bright red foreground text.
 
#define SIR_BREDB(s)
 Bold bright red foreground text.
 
#define SIR_GREEN(s)
 Green foreground text.
 
#define SIR_GREENB(s)
 Bold green foreground text.
 
#define SIR_BGREEN(s)
 Bright green foreground text.
 
#define SIR_BGREENB(s)
 Bold bright green foreground text.
 
#define SIR_YELLOW(s)
 Yellow foreground text.
 
#define SIR_YELLOWB(s)
 Bold yellow foreground text.
 
#define SIR_BYELLOW(s)
 Bright yellow foreground text.
 
#define SIR_BYELLOWB(s)
 Bold bright yellow foreground text.
 
#define SIR_BLUE(s)
 Blue foreground text.
 
#define SIR_BLUEB(s)
 Bold blue foreground text.
 
#define SIR_BBLUE(s)
 Bright blue foreground text.
 
#define SIR_BBLUEB(s)
 Bold bright blue foreground text.
 
#define SIR_MAGENTA(s)
 Magenta foreground text.
 
#define SIR_MAGENTAB(s)
 Bold magenta foreground text.
 
#define SIR_BMAGENTA(s)
 Bright magenta foreground text.
 
#define SIR_BMAGENTAB(s)
 Bold bright magenta foreground text.
 
#define SIR_CYAN(s)
 Cyan foreground text.
 
#define SIR_CYANB(s)
 Bold cyan foreground text.
 
#define SIR_BCYAN(s)
 Bright cyan foreground text.
 
#define SIR_BCYANB(s)
 Bold bright cyan foreground text.
 
#define SIR_BGRAY(s)
 Bright gray foreground text.
 
#define SIR_BGRAYB(s)
 Bold bright gray foreground text.
 
#define SIR_DGRAY(s)
 Dark gray foreground text.
 
#define SIR_DGRAYB(s)
 Bold dark gray foreground text.
 
#define SIR_WHITE(s)
 White foreground text.
 
#define SIR_WHITEB(s)
 Bold white foreground text.
 

Detailed Description

ANSI escape sequence macros.

A collection of macros that can be used with libsir's logging functions as well as [f]printf, puts, etc. to manipulate terminal output.

Example

printf(RED("Something terrible happened!" SIR_EOL));
#define SIR_EOL
The end of line sequence.
Definition config.h:91
Version
2.2.6

SPDX-License-Identifier: MIT

Copyright (c) 2018-2024 Ryan M. Lederman leder.nosp@m.man@.nosp@m.gmail.nosp@m..com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Macro Definition Documentation

◆ SIR_COLOR

#define SIR_COLOR ( attr,
fg,
bg,
s )
Value:
SIR_ESC_SEQ(#attr ";" #fg ";" #bg, s) SIR_ESC_SEQE("0;39;49")

Creates a sequence of colored characters 's' with foreground color 'fg', background color 'bg', and attributes 'attr' (0=normal, 1=bold, 2=dim, 3=italic, 4=underlined, 5=blinking, 7=inverted, 9=strikethrough).

Ends by resetting to the default fg/bg color, and normal attr.