faressoft / terminalizer

🦄 Record your terminal and generate animated gif images or share a web player
https://terminalizer.com
MIT License
15.31k stars 499 forks source link

support bold typeface? #95

Open stuartcrobinson opened 4 years ago

stuartcrobinson commented 4 years ago

terminalizer doesn't seem to support bold fonts in the terminal.

any plan to support this? would be amazing

Miesvanderlippe commented 4 years ago

bold

stuartcrobinson commented 4 years ago

hi @Miesvanderlippe , thank you for the kind, thoughtful response. could you share the content of the terminalizer recordingFile that you used in this demo? terminalizer doesn't seem to be automatically noticing the bold typeface in my terminal recordings:

image

to highlight thicker letter widths in the terminal vs same letter widths in terminalizer:

image

but if you share the syntax to create bold formatting i can just update the file manually.

unless you suggest a better route?

or maybe "bold" isn't the right term? perhaps there is a font width specification i'm not familiar with. thanks again

Miesvanderlippe commented 4 years ago

Here's my recording.

records:
  - delay: 391
    content: "\e]0;\a\e[01;32m[bold-demo\e[01;37m github\e[01;32m]$\e[00m "
  - delay: 492
    content: "\e\r\n"
  - delay: 492
    content: "\e[1mbold text \e[0m works\r\n"

I do my recordings using this Python coloring thing; https://stackoverflow.com/questions/287871/how-to-print-colored-text-in-terminal-in-python

And I'm actually just generating the recordings from Python directly for which I adjusted the class to have escapes (but just recording the StackOverflow thing works too).

Adjusted version:

class bcolors:
    HEADER = '\\e[95m'
    OKBLUE = '\\e[94m'
    OKGREEN = '\\e[92m'
    WARNING = '\\e[93m'
    FAIL = '\\e[91m'
    ENDC = '\\e[0m'
    BOLD = '\\e[1m'
    UNDERLINE = '\\e[4m'

def generate_lines(lines: []) -> str:
    result = ""
    for _ in range(0, 9): 
        result += "  - delay: 492\n"
        result += "    content: \"" + bcolors.BOLD  + "bold text " + bcolors.ENDC + " works" + "\\r\\n\"\n"
    return result

My result is then pasted into a template with the config above it etc. Should be fairly obvious.