-
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
5 changed files
with
75 additions
and
25 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
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,54 @@ | ||
# Color map | ||
|
||
{{story cast layout/dynamic/color-map}} | ||
|
||
A `:color-map` node applies a [color map](/parameters/colors.md#color-maps) to its contents. | ||
|
||
```janet | ||
{ | ||
:type :color-map | ||
:map @{} # color map, dynamic | ||
:node {} # a node | ||
} | ||
``` | ||
|
||
`:map` | ||
|
||
A [color map](/api.md#color-map). | ||
|
||
`:node` | ||
|
||
A valid layout node. | ||
|
||
|
||
## Example | ||
|
||
The example at the top of the page was created with the following Janet code: | ||
|
||
```janet | ||
(def cmd1 (cmd/new :root :command "htop")) | ||
(def cmd2 (cmd/new :root :command "htop")) | ||
(def cmd3 (cmd/new :root :command "htop")) | ||
(defn | ||
theme [layout] | ||
(def node (layout/attach-id layout)) | ||
(if | ||
# Apply one color scheme if the client is not attached to this node | ||
(nil? node) ((color-maps/get :atelier-sulphurpool) :map) | ||
# And a different one if they are | ||
((color-maps/get :atelier-sulphurpool-light) :map))) | ||
(layout/set (layout/new | ||
(split | ||
(split | ||
(color-map | ||
theme | ||
(attach :id cmd1)) | ||
(color-map | ||
theme | ||
(pane :id cmd2)) | ||
:vertical true) | ||
(color-map | ||
theme | ||
(pane :id cmd3))))) | ||
``` |
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