-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Themes | ||
|
||
You can configure almost anything about `cy`'s appearance by changing [default parameters](/default-parameters.md) to your liking. This includes colors, border styles, and UI copy (such as for localization.) | ||
|
||
For example: | ||
|
||
{{story static theme}} | ||
|
||
This theme was created with the following Janet code: | ||
|
||
```janet | ||
(param/set-many :root | ||
:replay-text-copy-mode "копировка" | ||
:replay-status-bar-bg "#6699cc" | ||
:replay-copy-bg "#99cc99" | ||
:replay-copy-fg "#2d2d2d" | ||
:input-prompt-bg "#f2777a" | ||
:color-error "#f2777a" | ||
:color-warning "#ffcc66" | ||
:color-info "#6699cc" | ||
:timestamp-format "начало революции: 2006-01-02 15:04:05") | ||
``` | ||
|
||
Theme parameters work exactly like any other parameter. If you set a parameter with a target of `:client`, it overrides any other parameter. Parameters set on [tree nodes](/groups-and-panes.md#groups) override the parameter values of their ancestor nodes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package cy | ||
|
||
import ( | ||
"context" | ||
_ "embed" | ||
|
||
"github.com/cfoust/cy/pkg/layout" | ||
"github.com/cfoust/cy/pkg/layout/prop" | ||
"github.com/cfoust/cy/pkg/mux" | ||
"github.com/cfoust/cy/pkg/replay" | ||
"github.com/cfoust/cy/pkg/replay/player" | ||
"github.com/cfoust/cy/pkg/sessions" | ||
"github.com/cfoust/cy/pkg/stories" | ||
"github.com/cfoust/cy/pkg/style" | ||
) | ||
|
||
//go:embed theme_story.janet | ||
var THEME_STORY_SETUP string | ||
|
||
var initTheme stories.InitFunc = func(ctx context.Context) (mux.Screen, error) { | ||
server, client, screen, err := createStory(ctx) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = client.execute(THEME_STORY_SETUP) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
rootParams := server.tree.Root().Params() | ||
s := sessions.NewSimulator(). | ||
Defaults(). | ||
Add( | ||
"This sense of wandering in a space which is at once informational and uses the open Internet as a guiding principle for navigation is something that builds on a series of \"Net Nomad\" projects developed by the artist in the 1990s. Here, Cheang launches herself into the space of the nets, roaming the world and documenting her travels, finding routes and the means to travel via blagged and hustled connections, throwing life through the window onto the screen.\n\n", | ||
"3x3x6, shu lea chang", | ||
) | ||
|
||
var replayTop int32 | ||
{ | ||
r := replay.New( | ||
ctx, | ||
player.FromEvents(s.Events()), | ||
server.timeBinds, | ||
server.copyBinds, | ||
replay.WithParams(rootParams), | ||
replay.WithCopyMode, | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
p := server.tree.Root().NewPane(ctx, r) | ||
replayTop = p.Id() | ||
} | ||
|
||
var replayBottom int32 | ||
{ | ||
r := replay.New( | ||
ctx, | ||
player.FromEvents(s.Events()), | ||
server.timeBinds, | ||
server.copyBinds, | ||
replay.WithParams(rootParams), | ||
) | ||
if err != nil { | ||
return nil, err | ||
} | ||
p := server.tree.Root().NewPane(ctx, r) | ||
replayBottom = p.Id() | ||
} | ||
|
||
err = client.SetLayout(layout.New(layout.SplitType{ | ||
Vertical: true, | ||
Border: prop.NewStatic(&style.DefaultBorder), | ||
A: layout.PaneType{ | ||
ID: &replayTop, | ||
}, | ||
B: layout.PaneType{ | ||
ID: &replayBottom, | ||
Attached: true, | ||
}, | ||
})) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = client.execute(` | ||
(msg/toast :info "this shows up in blue") | ||
(msg/toast :warn "this shows up in yellow") | ||
(msg/toast :error "this shows up in red") | ||
`) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
go func() { | ||
client.execute(` | ||
(input/find @["У лукоморья дуб зелёный" "Златая цепь на дубе том" "И днём и ночью кот учёный"] | ||
:prompt "выбор строчки" | ||
:animated false)`) | ||
}() | ||
|
||
return screen, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(param/set-many :root | ||
:replay-text-copy-mode "копировка" | ||
:replay-status-bar-bg "#6699cc" | ||
:replay-copy-bg "#99cc99" | ||
:replay-copy-fg "#2d2d2d" | ||
:input-prompt-bg "#f2777a" | ||
:color-error "#f2777a" | ||
:color-warning "#ffcc66" | ||
:color-info "#6699cc" | ||
:timestamp-format "начало революции: 2006-01-02 15:04:05") |