Skip to content

[Bug] Fix Light Color for Spinner Title Style - #346

Merged
bashbunni merged 1 commit into
charmbracelet:mainfrom
hyorigo:patch-1
Aug 7, 2024
Merged

bashbunni merged 1 commit into
charmbracelet:mainfrom
hyorigo:patch-1

Conversation

@hyorigo

@hyorigo hyorigo commented Aug 1, 2024

Copy link
Copy Markdown
Contributor

Bug: Title Text is same white on Light background terminal

Bug: Title Text is same white on Light background terminal
@hyorigo
hyorigo requested a review from maaslalani as a code owner August 1, 2024 11:36
@hyorigo hyorigo changed the title Fix Light Color for Spinner Title Style [Bug] Fix Light Color for Spinner Title Style Aug 1, 2024
@meowgorithm

Copy link
Copy Markdown
Member

Thanks for this. Mind posting a screenshot so we can see what it looks like on a light background?

@hyorigo

hyorigo commented Aug 2, 2024

Copy link
Copy Markdown
Contributor Author

Without this fix ---

On dark background (Tange Dark of iTerm2):

image

On light background (Tango Light of iTerm2):

image

Code to repro:

	action := func() {
		time.Sleep(5 * time.Second)
	}
	fmt.Println("Begin")
	spinner.New().
		Title("Loading Text is Here").
		Type(spinner.MiniDot).
		Action(action).
		Run()
	fmt.Println("End")

With this fix:

image

Simple Code to verify ---

	action := func() {
		time.Sleep(5 * time.Second)
	}
	fmt.Println("Begin")
	spinner.New().
		Title("Loading Text is Here").
		Type(spinner.MiniDot).
		TitleStyle(lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "#00020A", Dark: "#FFFDF5"})).
		Action(action).
		Run()
	fmt.Println("End")

@hyorigo

hyorigo commented Aug 2, 2024

Copy link
Copy Markdown
Contributor Author

Btw, the magic color #00020A is the reverse (or complementary) color of a given hex color #FFFDF5.

Given hex color: #FFFDF5

  1. Convert #FFFDF5 to RGB:

    • Red (R): FF (hex) = 255 (decimal)
    • Green (G): FD (hex) = 253 (decimal)
    • Blue (B): F5 (hex) = 245 (decimal)
  2. Subtract each component from 255:

    • Red: (255 - 255 = 0)
    • Green: (255 - 253 = 2)
    • Blue: (255 - 245 = 10)
  3. Convert the results back to hex:

    • Red: (0) (decimal) = (00) (hex)
    • Green: (2) (decimal) = (02) (hex)
    • Blue: (10) (decimal) = (0A) (hex)

So, the reverse color of #FFFDF5 is #00020A.

@hyorigo

hyorigo commented Aug 2, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for this. Mind posting a screenshot so we can see what it looks like on a light background?

@meowgorithm I've added the requested screenshots and code samples demonstrating the issue and fix.

Could you please review the updated PR when you have a moment? Thanks!

@meowgorithm meowgorithm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you @hyorigo!

Now I'm wondering if Lip Gloss should have color manipulation tools.

@bashbunni

Copy link
Copy Markdown
Contributor

@meowgorithm yeah seriously, this is really great

@bashbunni
bashbunni merged commit d8d2851 into charmbracelet:main Aug 7, 2024
@hyorigo
hyorigo deleted the patch-1 branch August 8, 2024 04:44
renovate Bot referenced this pull request in jippi/dottie Aug 23, 2024
….mod (#85)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [github.com/charmbracelet/huh](https://togithub.com/charmbracelet/huh)
| `v0.5.2` -> `v0.5.3` |
[![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fcharmbracelet%2fhuh/v0.5.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2fcharmbracelet%2fhuh/v0.5.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2fcharmbracelet%2fhuh/v0.5.2/v0.5.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fcharmbracelet%2fhuh/v0.5.2/v0.5.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charmbracelet/huh (github.com/charmbracelet/huh)</summary>

###
[`v0.5.3`](https://togithub.com/charmbracelet/huh/releases/tag/v0.5.3)

[Compare
Source](https://togithub.com/charmbracelet/huh/compare/v0.5.2...v0.5.3)

### Crushin’ bugs

This release fixes a buncha bugs in Huh and
[Gum](https://togithub.com/charmbracelet/gum) alike. Gum users, stay
tuned for an update later today.

#### What's Changed

##### Fixed

- fix: group varying heights by
[@&#8203;bashbunni](https://togithub.com/bashbunni) in
[https://github.com/charmbracelet/huh/pull/350](https://togithub.com/charmbracelet/huh/pull/350)
- fix: group size when height is 0 by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/363](https://togithub.com/charmbracelet/huh/pull/363)
- fix(filepicker): not closing on close by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/323](https://togithub.com/charmbracelet/huh/pull/323)
- fix(select): wrapping selects by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/324](https://togithub.com/charmbracelet/huh/pull/324)
- fix(select): select all/none by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/325](https://togithub.com/charmbracelet/huh/pull/325)
- fix(multiselect): contextual 'select all' help text by
[@&#8203;meowgorithm](https://togithub.com/meowgorithm) in
[https://github.com/charmbracelet/huh/pull/342](https://togithub.com/charmbracelet/huh/pull/342)
- fix(spinner): light color in title by
[@&#8203;hyorigo](https://togithub.com/hyorigo) in
[https://github.com/charmbracelet/huh/pull/346](https://togithub.com/charmbracelet/huh/pull/346)
- fix (multiselect): set filterable not working by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/335](https://togithub.com/charmbracelet/huh/pull/335)
- fix(lint): golangci-lint issues by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/378](https://togithub.com/charmbracelet/huh/pull/378)

#### Other Stuff

- chore: update codeowners by
[@&#8203;caarlos0](https://togithub.com/caarlos0) in
[https://github.com/charmbracelet/huh/pull/379](https://togithub.com/charmbracelet/huh/pull/379)
- refactor: use a selector type to select items by
[@&#8203;aymanbagabas](https://togithub.com/aymanbagabas) in
[https://github.com/charmbracelet/huh/pull/328](https://togithub.com/charmbracelet/huh/pull/328)
- refactor: make item selector into a slice container by
[@&#8203;aymanbagabas](https://togithub.com/aymanbagabas) in
[https://github.com/charmbracelet/huh/pull/334](https://togithub.com/charmbracelet/huh/pull/334)

#### New Contributors

- [@&#8203;bashbunni](https://togithub.com/bashbunni) made their first
contribution in
[https://github.com/charmbracelet/huh/pull/350](https://togithub.com/charmbracelet/huh/pull/350)
- [@&#8203;hyorigo](https://togithub.com/hyorigo) made their first
contribution in
[https://github.com/charmbracelet/huh/pull/346](https://togithub.com/charmbracelet/huh/pull/346)

**Full Changelog**:
charmbracelet/huh@v0.5.2...v0.5.3

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* */1 * * *" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job log](https://developer.mend.io/github/jippi/dottie).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

⌂ 换网址