on main help sign in
chore(ui,styles): color edits and copyedits for the oAuth view
9c4a316Christian Rocha
internal/ui/dialog/oauth.go+17−17
@@ -222,7 +222,7 @@ func (m *OAuth) headerContent() string {
222 textStyle = t.Dialog.PrimaryText
222 textStyle = t.Dialog.PrimaryText
223 dialogStyle = t.Dialog.View.Width(m.width)
223 dialogStyle = t.Dialog.View.Width(m.width)
224 headerOffset = titleStyle.GetHorizontalFrameSize() + dialogStyle.GetHorizontalFrameSize()
224 headerOffset = titleStyle.GetHorizontalFrameSize() + dialogStyle.GetHorizontalFrameSize()
225− dialogTitle = fmt.Sprintf("Authenticate with %s", m.oAuthProvider.name())
225+ dialogTitle = fmt.Sprintf("Let’s authenticate with %s", m.oAuthProvider.name())
226 )
226 )
227 if m.isOnboarding {
227 if m.isOnboarding {
228 return textStyle.Render(dialogTitle)
228 return textStyle.Render(dialogTitle)
@@ -232,13 +232,13 @@ func (m *OAuth) headerContent() string {
232
232
233func (m *OAuth) innerDialogContent() string {
233func (m *OAuth) innerDialogContent() string {
234 var (
234 var (
235− t = m.com.Styles
235+ t = m.com.Styles
236− whiteStyle = t.Dialog.OAuth.Instructions
236+ instructionStyle = t.Dialog.OAuth.Instructions
237− primaryStyle = t.Dialog.OAuth.Enter
237+ enterKeyStyle = t.Dialog.OAuth.Enter
238− greenStyle = t.Dialog.OAuth.Success
238+ successStyle = t.Dialog.OAuth.Success
239− linkStyle = t.Dialog.OAuth.Link
239+ linkStyle = t.Dialog.OAuth.Link
240− errorStyle = t.Dialog.OAuth.ErrorText
240+ errorStyle = t.Dialog.OAuth.ErrorText
241− mutedStyle = t.Dialog.OAuth.StatusText
241+ statusTextStyle = t.Dialog.OAuth.StatusText
242 )
242 )
243
243
244 switch m.State {
244 switch m.State {
@@ -248,8 +248,8 @@ func (m *OAuth) innerDialogContent() string {
248 Width(m.width - 2).
248 Width(m.width - 2).
249 Align(lipgloss.Center).
249 Align(lipgloss.Center).
250 Render(
250 Render(
251− greenStyle.Render(m.spinner.View()) +
251+ successStyle.Render(m.spinner.View()) +
252− mutedStyle.Render("Initializing..."),
252+ statusTextStyle.Render("Initializing..."),
253 )
253 )
254
254
255 case OAuthStateDisplay:
255 case OAuthStateDisplay:
@@ -257,9 +257,9 @@ func (m *OAuth) innerDialogContent() string {
257 Margin(0, 1).
257 Margin(0, 1).
258 Width(m.width - 2).
258 Width(m.width - 2).
259 Render(
259 Render(
260− whiteStyle.Render("Press ") +
260+ instructionStyle.Render("Press ") +
261− primaryStyle.Render("enter") +
261+ enterKeyStyle.Render("enter") +
262− whiteStyle.Render(" to copy the code below and open the browser."),
262+ instructionStyle.Render(" to copy the code below and open the browser."),
263 )
263 )
264
264
265 codeBox := lipgloss.NewStyle().
265 codeBox := lipgloss.NewStyle().
@@ -273,16 +273,16 @@ func (m *OAuth) innerDialogContent() string {
273 )
273 )
274
274
275 link := linkStyle.Hyperlink(m.verificationURL, "id=oauth-verify").Render(m.verificationURL)
275 link := linkStyle.Hyperlink(m.verificationURL, "id=oauth-verify").Render(m.verificationURL)
276− url := mutedStyle.
276+ url := statusTextStyle.
277 Margin(0, 1).
277 Margin(0, 1).
278 Width(m.width - 2).
278 Width(m.width - 2).
279− Render("Browser not opening? Refer to\n" + link)
279+ Render("Browser not opening? Pay a visit to:\n" + link)
280
280
281 waiting := lipgloss.NewStyle().
281 waiting := lipgloss.NewStyle().
282 Margin(0, 1).
282 Margin(0, 1).
283 Width(m.width - 2).
283 Width(m.width - 2).
284 Render(
284 Render(
285− greenStyle.Render(m.spinner.View()) + mutedStyle.Render("Verifying..."),
285+ successStyle.Render(m.spinner.View()) + statusTextStyle.Render("Verifying..."),
286 )
286 )
287
287
288 return lipgloss.JoinVertical(
288 return lipgloss.JoinVertical(
@@ -299,7 +299,7 @@ func (m *OAuth) innerDialogContent() string {
299 )
299 )
300
300
301 case OAuthStateSuccess:
301 case OAuthStateSuccess:
302− return greenStyle.
302+ return successStyle.
303 Margin(1).
303 Margin(1).
304 Width(m.width - 2).
304 Width(m.width - 2).
305 Render("Authentication successful!")
305 Render("Authentication successful!")
internal/ui/styles/quickstyle.go+10−10
@@ -14,13 +14,14 @@ import (
14 "github.com/charmbracelet/x/exp/charmtone"
14 "github.com/charmbracelet/x/exp/charmtone"
15)
15)
16
16
17−// quickStyleOpts is the palette of colors used by quickStyle to build a
17+// quickStyleOpts is the palette of colors used by quickStyle to simplify the
18−// complete Styles value. Each field maps to a semantic role in the UI.
18+// process of building a theme.
19type quickStyleOpts struct {
19type quickStyleOpts struct {
20 // Brand.
20 // Brand.
21 primary color.Color
21 primary color.Color
22 secondary color.Color
22 secondary color.Color
23 accent color.Color
23 accent color.Color
24+ keyword color.Color
24
25
25 // Default foreground and background colors.
26 // Default foreground and background colors.
26 fgBase color.Color
27 fgBase color.Color
@@ -55,12 +56,11 @@ type quickStyleOpts struct {
55 successMostSubtle color.Color
56 successMostSubtle color.Color
56}
57}
57
58
58−// quickStyle builds a complete Styles value from a palette of semantic
59+// quickStyle builds the default Styles (that is, the default theme, Charmtone
59−// colors. Themes should populate quickStyleOpts and call this rather than
60+// Pantera) from a palette of semi-semanticly-named colors.
60−// re-implementing every style rule.
61//
61//
62−// The idea here is that you can do most of the work with quickStyle, then
62+// The idea here is that you can do most of the work on a theme with quickStyle,
63−// add overrides as needed.
63+// then add overrides as needed.
64func quickStyle(o quickStyleOpts) Styles {
64func quickStyle(o quickStyleOpts) Styles {
65 var (
65 var (
66 base = lipgloss.NewStyle().Foreground(o.fgBase)
66 base = lipgloss.NewStyle().Foreground(o.fgBase)
@@ -863,11 +863,11 @@ func quickStyle(o quickStyleOpts) Styles {
863
863
864 // OAuth dialog
864 // OAuth dialog
865 s.Dialog.OAuth.Spinner = base.Foreground(o.successMoreSubtle)
865 s.Dialog.OAuth.Spinner = base.Foreground(o.successMoreSubtle)
866− s.Dialog.OAuth.Instructions = lipgloss.NewStyle().Foreground(o.primary)
866+ s.Dialog.OAuth.Instructions = lipgloss.NewStyle().Foreground(o.fgBase)
867− s.Dialog.OAuth.UserCode = lipgloss.NewStyle().Bold(true).Foreground(o.primary)
867+ s.Dialog.OAuth.UserCode = lipgloss.NewStyle().Bold(true).Foreground(o.fgBase)
868 s.Dialog.OAuth.Success = lipgloss.NewStyle().Foreground(o.successMoreSubtle)
868 s.Dialog.OAuth.Success = lipgloss.NewStyle().Foreground(o.successMoreSubtle)
869 s.Dialog.OAuth.Link = lipgloss.NewStyle().Foreground(o.successMostSubtle).Underline(true)
869 s.Dialog.OAuth.Link = lipgloss.NewStyle().Foreground(o.successMostSubtle).Underline(true)
870− s.Dialog.OAuth.Enter = lipgloss.NewStyle().Foreground(o.primary)
870+ s.Dialog.OAuth.Enter = lipgloss.NewStyle().Foreground(o.keyword)
871 s.Dialog.OAuth.ErrorText = lipgloss.NewStyle().Foreground(o.error)
871 s.Dialog.OAuth.ErrorText = lipgloss.NewStyle().Foreground(o.error)
872 s.Dialog.OAuth.StatusText = lipgloss.NewStyle().Foreground(o.fgMoreSubtle)
872 s.Dialog.OAuth.StatusText = lipgloss.NewStyle().Foreground(o.fgMoreSubtle)
873 s.Dialog.OAuth.UserCodeBg = o.bgLeastVisible
873 s.Dialog.OAuth.UserCodeBg = o.bgLeastVisible
internal/ui/styles/themes.go+1
@@ -21,6 +21,7 @@ func CharmtonePantera() Styles {
21 primary: charmtone.Charple,
21 primary: charmtone.Charple,
22 secondary: charmtone.Dolly,
22 secondary: charmtone.Dolly,
23 accent: charmtone.Bok,
23 accent: charmtone.Bok,
24+ keyword: charmtone.Blush,
24
25
25 fgBase: charmtone.Ash,
26 fgBase: charmtone.Ash,
26 fgMoreSubtle: charmtone.Squid,
27 fgMoreSubtle: charmtone.Squid,