dynamo-browse/internal/common/ui/osstyle/detect.go
Leon Mika f373a3313a
A few bug-fixes and maintenance tasks (#30)
- Fixed a bug which was not properly detecting whether MacOS was in light mode.
- Fixed a bug which was breaking filtering with the table-selection mode.
- Upgraded bubble-tea.
2022-10-04 13:01:53 +11:00

25 lines
626 B
Go

package osstyle
import (
"github.com/charmbracelet/lipgloss"
"log"
)
func DetectCurrentScheme() {
if lipgloss.HasDarkBackground() {
if colorScheme := CurrentColorScheme(); colorScheme == ColorSchemeLightMode {
log.Printf("terminal reads dark but really in light mode")
lipgloss.SetHasDarkBackground(true)
} else {
log.Printf("in dark background")
}
} else {
if colorScheme := CurrentColorScheme(); colorScheme == ColorSchemeDarkMode {
log.Printf("terminal reads light but really in dark mode")
lipgloss.SetHasDarkBackground(true)
} else {
log.Printf("cannot detect system darkmode")
}
}
}