-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create LICENSE.txt * feat: start toolchain * feat: colors 16..231 * feat: colors 1..6 * feat: web bullying with mateus * feat: gray scale * style: clang format * style: organize pride.c * feat: optmize library * feat: beyonce * style: clang format
- Loading branch information
1 parent
bd2bf96
commit 01a7be7
Showing
12 changed files
with
556 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
BasedOnStyle: Mozilla | ||
ColumnLimit: 80 | ||
IndentWidth: 4 | ||
UseTab: Never | ||
--- | ||
Language: Cpp | ||
AllowShortIfStatementsOnASingleLine: Never | ||
BreakBeforeBraces: Attach | ||
AllowShortBlocksOnASingleLine: true | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortFunctionsOnASingleLine: Inline | ||
DerivePointerAlignment: false | ||
PointerAlignment: Right |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.h linguist-language=C | ||
*.sh linguist-generated | ||
Makefile linguist-generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: rodrigodornelles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: ci | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
clang-format: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/checkout@v2 | ||
- | ||
run: clang-format --dry-run --Werror --verbose rgb_to_xterm256.h | ||
- | ||
run: clang-format --dry-run --Werror --verbose tools/pride.c | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
uses: actions/checkout@v2 | ||
- | ||
run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.out | ||
*.exe | ||
*.zip | ||
*.txt | ||
!LICENSE.txt | ||
pride | ||
html/ | ||
latex/ | ||
DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
|
||
Copyright (C) 2024 Rodrigo Dornelles | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
unsigned char | ||
rgb_to_xterm256(unsigned char r, unsigned char g, unsigned char b) { | ||
|
||
unsigned int color_id = 0; | ||
unsigned char half_color = (r >= 0x80 && r < 0x87) << 2 | | ||
(g >= 0x80 && g < 0x87) << 1 | | ||
(b >= 0x80 && b < 0x87); | ||
|
||
static const unsigned char gray_brightness[] = { | ||
0x00, 0x08, 0x12, 0x1c, 0x26, 0x30, 0x3a, 0x44, 0x4e, 0x58, 0x5f, | ||
0x62, 0x6c, 0x76, 0x80, 0x87, 0x8a, 0x94, 0x9e, 0xa8, 0xaf, 0xb2, | ||
0xbc, 0xc0, 0xc6, 0xd0, 0xd7, 0xda, 0xe4, 0xee, 0xff | ||
}; | ||
|
||
static const unsigned char gray_colors[] = { | ||
0x00, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0x3b, | ||
0xf1, 0xf2, 0xf3, 0xf4, 0x66, 0xf5, 0xf6, 0xf7, 0xf8, 0x91, 0xf9, | ||
0xfa, 0x07, 0xfb, 0xfc, 0xbc, 0xfd, 0xfe, 0xff, 0x0f | ||
}; | ||
|
||
static const unsigned char term_colors[] = { 0x04, 0x02, 0x06, | ||
0x01, 0x05, 0x03 }; | ||
|
||
if (r == g && g == b) { | ||
unsigned char i = 0; | ||
|
||
while (gray_brightness[i] < r) { | ||
i++; | ||
} | ||
|
||
color_id = gray_colors[i]; | ||
} else if (half_color) { | ||
color_id = term_colors[half_color - 1]; | ||
} else { | ||
r = ((r << 2) + r) / 255; | ||
g = ((g << 2) + g) / 255; | ||
b = ((b << 2) + b) / 255; | ||
color_id = 16 + ((r << 5) + (r << 2)) + ((g << 2) + (g << 1)) + b; | ||
} | ||
|
||
return color_id; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.