Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add \033[2m faint escape sequence using css opacity #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion aha.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ enum ColorMode {
struct State {
int fc, bc;
int bold;
int faint;
int italic;
int underline;
int blink;
Expand Down Expand Up @@ -474,6 +475,7 @@ const struct State default_state = {
.fc = -1, //Standard Foreground Color //IRC-Color+8
.bc = -1, //Standard Background Color //IRC-Color+8
.bold = 0,
.faint = 0,
.italic = 0,
.underline = 0,
.blink = 0,
Expand All @@ -488,6 +490,7 @@ int statesDiffer(const struct State *const old, const struct State *const new) {
(old->fc != new->fc) ||
(old->bc != new->bc) ||
(old->bold != new->bold) ||
(old->faint != new->faint) ||
(old->italic != new->italic) ||
(old->underline != new->underline) ||
(old->blink != new->blink) ||
Expand Down Expand Up @@ -612,6 +615,7 @@ void printHeader(const struct Options *opts)
}
printf(".underline {text-decoration: underline;}\n");
printf(".bold {font-weight: bold;}\n");
printf(".faint {opacity: 0.33;}\n");
printf(".italic {font-style: italic;}\n");
printf(".blink {text-decoration: blink;}\n");
printf(".crossed-out {text-decoration: line-through;}\n");
Expand Down Expand Up @@ -748,6 +752,10 @@ int main(int argc,char* args[])
state.bold=1;
break;

case 2: // 2 - Enable Faint
state.faint=1;
break;

case 3: // 3 - Enable Italic
state.italic=1;
break;
Expand All @@ -770,8 +778,9 @@ int main(int argc,char* args[])
break;

case 21: // 21 - Reset bold
case 22: // 22 - Not bold, not "high intensity" color
case 22: // 22 - Not bold, not "high intensity" or "low intensity" color
state.bold=0;
state.faint=0;
break;

case 23: // 23 - Reset italic
Expand Down Expand Up @@ -1025,6 +1034,13 @@ int main(int argc,char* args[])
else
printf("font-weight:bold;");
}
if (state.faint)
{
if (opts.stylesheet)
printf("opacity ");
else
printf("opacity:0.33;");
}
if (state.italic)
{
if (opts.stylesheet)
Expand Down