Skip to content

ColorProfile not automatically detectedΒ #439

@adejoux

Description

@adejoux

Describe the bug

Hello, when running the programme below the Colorprofile is wrongly detected as ASCII. I need to setup it manually.

func main() {

        var style = lipgloss.NewStyle().
                Bold(true).
                Foreground(lipgloss.Color("9")).
                Background(lipgloss.Color("12")).
                PaddingTop(2).
                PaddingLeft(4).
                Width(22)

        // detected colorProfile is ASCII no color in the output
        fmt.Print(style.Render("Hello, kitty"))

        renderer := lipgloss.NewRenderer(os.Stdout, termenv.WithProfile(termenv.TrueColor))

        // setting manually the Colors profile
        renderer.SetColorProfile(termenv.TrueColor)

        style2 := renderer.NewStyle().Foreground(lipgloss.Color("#FF0000")) // bright red

        // Red color is displayed properly
        fmt.Print(style2.Render("Hello, World!"))

}

Setup
Please complete the following information along with version numbers, if applicable.

  • OS macOS
  • Shell zsh, nu Shell
  • Terminal Emulator kitty, iterm
  • Terminal Multiplexer tmux, none
  • Locale en_US.UTF-8

To Reproduce
Steps to reproduce the behavior:

  1. Run go program in the description

Source Code
Please include source code if needed to reproduce the behavior.

Expected behavior

I expected to have the Colors without setting up anything.

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions