Skip to content

Commit 0c3d9d6

Browse files
committed
feat(charm): add lipgloss styling with Slack brand colors under charm experiment
1 parent c449532 commit 0c3d9d6

11 files changed

Lines changed: 215 additions & 74 deletions

File tree

cmd/manifest/validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ func NewValidateCommand(clients *shared.ClientFactory) *cobra.Command {
9393
cmd.Printf(
9494
"\n%s: %s\n",
9595
style.Bold("App Manifest Validation Result"),
96-
style.Styler().Green("Valid"),
96+
style.Green("Valid"),
9797
)
9898
clients.IO.PrintTrace(ctx, slacktrace.ManifestValidateSuccess)
9999
} else {
100100
cmd.Printf(
101101
"\n%s: %s\n",
102102
style.Bold("App Manifest Validation Result"),
103-
style.Styler().Red("InValid"),
103+
style.Red("InValid"),
104104
)
105105
}
106106
}

cmd/root.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import (
4444
"github.com/slackapi/slack-cli/cmd/upgrade"
4545
versioncmd "github.com/slackapi/slack-cli/cmd/version"
4646
"github.com/slackapi/slack-cli/internal/cmdutil"
47+
"github.com/slackapi/slack-cli/internal/experiment"
4748
"github.com/slackapi/slack-cli/internal/iostreams"
4849
"github.com/slackapi/slack-cli/internal/pkg/version"
4950
"github.com/slackapi/slack-cli/internal/shared"
@@ -297,6 +298,7 @@ func InitConfig(ctx context.Context, clients *shared.ClientFactory, rootCmd *cob
297298

298299
// Init configurations
299300
clients.Config.LoadExperiments(ctx, clients.IO.PrintDebug)
301+
style.ToggleCharm(clients.Config.WithExperimentOn(experiment.Charm))
300302
// TODO(slackcontext) Consolidate storing CLI version to slackcontext
301303
clients.Config.Version = clients.CLIVersion
302304

cmd/upgrade/upgrade.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ func checkForUpdates(clients *shared.ClientFactory, cmd *cobra.Command) error {
7474
}
7575

7676
if clients.SDKConfig.Hooks.CheckUpdate.IsAvailable() {
77-
cmd.Printf("%s You are using the latest Slack CLI and SDK versions\n", style.Styler().Green("✔").String())
77+
cmd.Printf("%s You are using the latest Slack CLI and SDK versions\n", style.Green("✔"))
7878
} else {
79-
cmd.Printf("%s You are using the latest Slack CLI version\n", style.Styler().Green("✔").String())
79+
cmd.Printf("%s You are using the latest Slack CLI version\n", style.Green("✔"))
8080
}
8181

8282
return nil

internal/iostreams/printer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (io *IOStreams) PrintInfo(ctx context.Context, shouldTrace bool, format str
8989
span, _ := opentracing.StartSpanFromContext(ctx, "printInfo", opentracing.Tag{Key: "printInfo", Value: message})
9090
defer span.Finish()
9191
}
92-
io.Stdout.Println(style.Styler().Reset(message))
92+
io.Stdout.Println(message)
9393
}
9494

9595
// PrintTrace prints traceID and values to stdout if SLACK_TEST_TRACE=true

internal/pkg/apps/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,12 @@ func continueDespiteWarning(ctx context.Context, clients *shared.ClientFactory,
869869
clients.IO.PrintInfo(ctx, false,
870870
"\n%s: %s",
871871
style.Bold("Changes confirmed"),
872-
style.Styler().Green("Continuing with install."),
872+
style.Green("Continuing with install."),
873873
)
874874
return true, nil
875875
}
876876

877-
clients.IO.PrintInfo(ctx, false, "\n%s", style.Styler().Red("App install canceled."))
877+
clients.IO.PrintInfo(ctx, false, "\n%s", style.Red("App install canceled."))
878878

879879
return false, nil
880880
}

internal/pkg/platform/activity.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ func prettifyActivity(activity api.Activity) (log string) {
220220

221221
switch activity.Level {
222222
case types.WARN:
223-
return style.Styler().Yellow(msg).String()
223+
return style.Yellow(msg)
224224
case types.ERROR, types.FATAL:
225-
return style.Styler().Red(msg).String()
225+
return style.Red(msg)
226226
}
227227

228228
return msg
@@ -282,7 +282,7 @@ func externalAuthResultToString(activity api.Activity) (result string) {
282282
msg = msg + "\n\t\t" + strings.ReplaceAll(activity.Payload["extra_message"].(string), "\n", "\n\t\t")
283283
}
284284

285-
return style.Styler().Gray(13, msg).String()
285+
return style.Gray(msg)
286286
}
287287

288288
func externalAuthStartedToString(activity api.Activity) (result string) {
@@ -300,7 +300,7 @@ func externalAuthStartedToString(activity api.Activity) (result string) {
300300
msg = msg + "\n\t" + strings.ReplaceAll(activity.Payload["code"].(string), "\n", "\n\t")
301301
}
302302

303-
return style.Styler().Gray(13, msg).String()
303+
return style.Gray(msg)
304304
}
305305

306306
func externalAuthTokenFetchResult(activity api.Activity) (result string) {
@@ -318,13 +318,13 @@ func externalAuthTokenFetchResult(activity api.Activity) (result string) {
318318
msg = msg + "\n\t" + strings.ReplaceAll(activity.Payload["code"].(string), "\n", "\n\t")
319319
}
320320

321-
return style.Styler().Gray(13, msg).String()
321+
return style.Gray(msg)
322322
}
323323

324324
func functionDeploymentToString(activity api.Activity) (result string) {
325325
msg := fmt.Sprintf("Application %sd by user '%s' on team '%s'", activity.Payload["action"], activity.Payload["user_id"], activity.Payload["team_id"])
326326
msg = fmt.Sprintf("%s %s [%s] %s", style.Emoji("cloud"), activity.CreatedPretty(), activity.Level, msg)
327-
return style.Styler().Gray(13, msg).String()
327+
return style.Gray(msg)
328328
}
329329

330330
func functionExecutionOutputToString(activity api.Activity) (result string) {

internal/style/charm_theme.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,13 @@
1515
package style
1616

1717
// Slack brand theme for charmbracelet/huh prompts.
18-
// Uses official Slack brand colors to give the CLI a fun, playful feel.
18+
// Uses official Slack brand colors defined in colors.go.
1919

2020
import (
2121
"github.com/charmbracelet/huh"
2222
"github.com/charmbracelet/lipgloss"
2323
)
2424

25-
// Slack brand colors according to https://a.slack-edge.com/4d5bb/marketing/img/media-kit/slack_brand_guidelines_september2020.pdf
26-
var (
27-
slackAubergine = lipgloss.Color("#7C2852")
28-
slackBlue = lipgloss.Color("#36c5f0")
29-
slackGreen = lipgloss.Color("#2eb67d")
30-
slackYellow = lipgloss.Color("#ecb22e")
31-
slackRed = lipgloss.Color("#e01e5a")
32-
slackPool = lipgloss.Color("#78d7dd")
33-
slackLegalGray = lipgloss.Color("#5e5d60")
34-
slackOptionText = lipgloss.AdaptiveColor{Light: "#1d1c1d", Dark: "#f4ede4"}
35-
slackDescriptionText = lipgloss.AdaptiveColor{Light: "#454447", Dark: "#b9b5b0"}
36-
slackPlaceholderText = lipgloss.AdaptiveColor{Light: "#5e5d60", Dark: "#868380"}
37-
)
38-
3925
// ThemeSlack returns a huh theme styled with Slack brand colors.
4026
func ThemeSlack() *huh.Theme {
4127
t := huh.ThemeBase()

internal/style/colors.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2022-2026 Salesforce, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package style
16+
17+
// Slack brand color palette.
18+
// Single source of truth for all styling: lipgloss, huh themes, and bubbletea components.
19+
//
20+
// Colors from https://a.slack-edge.com/4d5bb/marketing/img/media-kit/slack_brand_guidelines_september2020.pdf
21+
22+
import "github.com/charmbracelet/lipgloss"
23+
24+
// Brand colors
25+
var (
26+
slackAubergine = lipgloss.Color("#7C2852")
27+
slackBlue = lipgloss.Color("#36c5f0")
28+
slackGreen = lipgloss.Color("#2eb67d")
29+
slackYellow = lipgloss.Color("#ecb22e")
30+
slackRed = lipgloss.Color("#e01e5a")
31+
slackRedDark = lipgloss.Color("#a01040")
32+
)
33+
34+
// Supplementary colors
35+
var (
36+
slackPool = lipgloss.Color("#78d7dd")
37+
slackLegalGray = lipgloss.Color("#5e5d60")
38+
)
39+
40+
// Adaptive colors that adjust for light/dark terminal backgrounds
41+
var (
42+
slackOptionText = lipgloss.AdaptiveColor{Light: "#1d1c1d", Dark: "#f4ede4"}
43+
slackDescriptionText = lipgloss.AdaptiveColor{Light: "#454447", Dark: "#b9b5b0"}
44+
slackPlaceholderText = lipgloss.AdaptiveColor{Light: "#5e5d60", Dark: "#868380"}
45+
)

0 commit comments

Comments
 (0)