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

Reset ansi colour #69

Merged
merged 4 commits into from
Nov 27, 2024
Merged

Reset ansi colour #69

merged 4 commits into from
Nov 27, 2024

Conversation

tmck-code
Copy link
Owner

@tmck-code tmck-code commented Nov 27, 2024

Context

pokesay can correctly display coloured text as of v0.14.0 🎉

If this text does not contain a colour reset code (\e[0m) at the end of every line, then the colour will bleed out into the bubble and surrounding terminal

before after
image image

Changes

  • Insert the ANSI colour reset code at the end of every line
  • correct a typo: SingleWidthCars -> SingleWidthChars
  • Remove a redundant tab -> space conversion
  • Rearrange the if statement in printSpeechBubbleLine
    • only need 2 branches - "needs padding" and "omit the bubble on the RHS"
    • (if the lines are exactly equal i.e. no padding, the strings.repeat function will return an empty string if the repeat value is 9)

this prevents colour from bleeding out/affecting the colour of the
bubble lines
this already happens in the caller
@tmck-code tmck-code merged commit d3f935a into master Nov 27, 2024
1 check passed
@tmck-code tmck-code deleted the reset-ansi-colour branch November 27, 2024 22:18
@tmck-code tmck-code added bug Something isn't working aesthetic Related to how pokesay looks labels Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aesthetic Related to how pokesay looks bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant