Skip to content

Commit 074e238

Browse files
committed
#235 define colors from define languages invocation
2 parents bee2bf7 + 792850e commit 074e238

32 files changed

+1812
-1826
lines changed

Diff for: .github/dependabot.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@ updates:
44
directory: "/"
55
schedule:
66
interval: "daily"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: daily
711
open-pull-requests-limit: 10

Diff for: .github/workflows/ci.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: CI
2-
on: [push]
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
pull_request:
6+
branches: [ master ]
37

48
jobs:
59
build:
@@ -34,7 +38,7 @@ jobs:
3438
name: Rustfmt
3539
runs-on: ubuntu-latest
3640
steps:
37-
- uses: actions/checkout@master
41+
- uses: actions/checkout@v2
3842
- name: Install Rust
3943
uses: actions-rs/toolchain@v1
4044
with:

Diff for: CONTRIBUTING.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Adding support for a new Language requires adding a new entry in the `define_lan
5757

5858
**Example**:
5959

60-
```{ CSharp, "csharp.ascii", "C#", { Colors { basic_colors: vec![Color::Blue, Color::Magenta], true_colors: Some(vec![Color::TrueColor{ r:0, g:0, b:255 }, Color::TrueColor{ r:255, g:0, b:255 }]) } }, "c#" },```
60+
` { CSharp, "csharp.ascii", "C#", define_colors!( [Color::Blue, Color::Magenta] ), "c#" }, `
6161

6262
The first item `CSharp` corresponds to the name of the language as defined in tokei. The second item `csharp.ascii` is the name of the file containing the ascii logo, this file has to be placed in the _./resources_ folder (more info below). The third item `C#` is the display name. Then we have the colors used to customize the look of the ascii logo when displayed to the screen. The last item `c#` is required only if the Enum name `CSharp` doesn't match the display name `C#`.
6363

@@ -89,13 +89,17 @@ Remarks:
8989
- Your ascii logo's dimensions must fall below `25*45` (height\*width). The CI will fail otherwise.
9090
- You can use `{N}` to color the ascii which will utilize the vec! of colors defined in `define_language!`
9191
- Make sure to trim any unnecessary trailing whitespaces
92-
- Make sure if you use true_colors that the number of true_colors matches the number of basic_colors
9392
- See example here [Ascii Art From Image File Using Python Image Library](https://github.com/o2sh/onefetch/wiki/ASCII-Art-From-Image-Using-Python-Image-Library)
94-
95-
- These are all equal color schemes, notice that a shortcut to duplicate the basic colors is to leave out true_colors entirely:
96-
```{ CSharp, "csharp.ascii", "C#", { Colors { basic_colors: vec![Color::Blue, Color::Magenta], true_colors: Some(vec![Color::TrueColor{ r:0, g:0, b:255 }, Color::TrueColor{ r:255, g:0, b:255 }]) } }, "c#" },```
97-
```{ CSharp, "csharp.ascii", "C#", { Colors { basic_colors: vec![Color::Blue, Color::Magenta], true_colors: None } }, "c#" },```
98-
```{ CSharp, "csharp.ascii", "C#", { vec![Color::Blue, Color::Magenta] }, "c#" },```
93+
- You must always provide an array of basic colors
94+
- Optionally, you may provide true colors in a second array of colors separated from the first array by a colon
95+
- One last approach allows you to define colors using the Colors structure itself
96+
- Make sure if you use true colors that the number of true colors matches the number of basic colors
97+
- For example, the following are equivalent:
98+
```
99+
{ CSharp, "csharp.ascii", "C#", define_colors!( [Color::Blue, Color::Magenta] ), "c#" },
100+
{ CSharp, "csharp.ascii", "C#", define_colors!( [Color::Blue, Color::Magenta] : [Color::TrueColor{ r:0, g:255, b:255 }, Color::TrueColor{ r:255, g:0, b:255 } ] ), "c#" },
101+
{ CSharp, "csharp.ascii", "C#", define_colors!( Colors { basic_colors: vec![Color::Blue, Color::Magenta] , true_colors: Some(vec![Color::TrueColor{ r:0, g:255, b:255 }, Color::TrueColor{ r:255, g:0, b:255 } ] ) } ), "c#" },
102+
```
99103

100104
### Project-specific notes
101105

0 commit comments

Comments
 (0)