Skip to content

Commit 2024c87

Browse files
committed
Changed README.md
1 parent 6029f51 commit 2024c87

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

README.md

+31-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<img src=".\media\kolor_3.png" alt="banner">
33
</p>
44

5-
<h3 align="center">Pretty terminal output using ANSI escape codes</h3>
5+
<h3 align="center">Pretty terminal output using ANSI escape sequences</h3>
66

77
[How it works](https://en.wikipedia.org/wiki/ANSI_escape_code)
88

@@ -14,26 +14,44 @@
1414

1515
int main() {
1616

17-
// set colors using constants
18-
std::cout << kolor::ESCAPE << kolor::FOREGROUND << kolor::format_rgb(200, 20, 50) << kolor::M << "Change colors using constants\n" << kolor::RESET;
17+
/**
18+
* This is an example on how to use kolor.
19+
* There are four different methods of changing the appearance of terminal output.
20+
* 1. Inline constants
21+
* 2. Inline set functions
22+
* 3. Wrapper functions
23+
* 4. Direct print functions
24+
*/
1925

20-
// set colors using inline set functions
21-
std::cout << kolor::set_fg(100, 23, 66) << "Change color using inline set functions\n" << kolor::RESET;
26+
// Option 1: Change appearance using inline constants
27+
// 1.1 Turn text bold using the most verbose constants
28+
std::cout << kolor::ESCAPE << kolor::BOLD << kolor::M << "This text was made bold using inline constants.\n" << kolor::ESCAPE << kolor::RESET << kolor::M;
2229

23-
// use print_bg function to change the background
24-
kolor::print_bg("Change background using print_bg\n", 23, 123, 90);
30+
// 1.2 Turn text bold using already escaped constants
31+
std::cout << kolor::BOLD_E << "This text was also made bold but with less code.\n" << kolor::RESET_E;
2532

26-
// use print_fg function to change the foreground
27-
kolor::print_fg("Change foreground using print_fg\n", 23, 123, 90);
33+
// Options 2: Change appearance using set functions
34+
// 2.1 Turn text italic using the set_italic and set_reset
35+
std::cout << kolor::set_italic() << "This text is italic.\n" << kolor::set_reset();
2836

29-
// use print function to change background and foreground of an output
30-
kolor::print("use print function to change background and foreground", 144, 252, 3, 3, 140, 252);
37+
// 2.2 Turn text green using set_fg_rgb and set_reset
38+
std::cout << kolor::set_fg_rgb(0,255,0) << "This text was made green using rgb values.\n" << kolor::set_reset();
3139

32-
// reset everything
33-
std::cout << kolor::RESET;
40+
// Option 3: Change appearance using wrapper functions
41+
// wip
3442

43+
// Option 4: Directly print text using print functions
44+
// 4.1 Print underlined text using print_underline
45+
kolor::print_underline("This text is underlined.\n");
46+
47+
// 4.2 Print red text using print_fg_rgb
48+
kolor::print_fg_rgb("This text is red.\n", 255, 0, 0);
49+
50+
// 4.3 Print text with blue background using print_bg_rgb
51+
kolor::print_bg_rgb("This text has a blue background.\n", 0, 0, 255);
3552
return 0;
3653
}
54+
3755
```
3856

3957
### Output

media/screenshot.png

587 KB
Loading

0 commit comments

Comments
 (0)