Skip to content

Nested colorize objects disable all attributes #10652

Open
@Blacksmoke16

Description

require "colorize"

foo = "foo".colorize.red

str = "hello #{foo} bar".colorize.underline

str => "\e[4mhello \e[31mfoo\e[0m bar\e[0m"

image

Because coloring/modes are reset via \e[0m all attributes are turned off, not just the one that is ending. The correct code sequence should be like "\e[4mhello \e[31mfoo\e[39m bar\e[24m". I.e. \e[39m only resets the foreground color and \e[24m only resets the underline.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    kind:bugA bug in the code. Does not apply to documentation, specs, etc.topic:stdlib:text

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions