Skip to content

Commit 9d910ae

Browse files
authored
Merge pull request #1 from rohrsben/config-rework
Config rework
2 parents 87c79f5 + eb7ba2b commit 9d910ae

47 files changed

Lines changed: 1436 additions & 1420 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/.vitepress/config.mts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,12 @@ export default defineConfig({
1717
],
1818

1919
sidebar: [
20-
{ text: 'Introduction', link: '/introduction'},
2120
{
22-
text: 'Wavewall',
21+
text: 'Configuration',
2322
items: [
24-
{ text: 'Output', link: '/wavewall/output' },
25-
{ text: 'Generation', link: '/wavewall/generation' },
26-
],
27-
},
28-
{
29-
text: 'Tileset',
30-
items: [
31-
{ text: 'Info', link: '/tileset/info' },
32-
{ text: 'Selection', link: '/tileset/selection' },
33-
{ text: 'Pseudotiles', link: '/tileset/pseudotiles' },
34-
{ text: 'Recipes', link: 'tileset/recipes' },
35-
{ text: 'Colorizer', link: 'tileset/colorizer' },
23+
{ text: 'Output', link: '/configuration/output' },
24+
{ text: 'Tileset', link: '/configuration/tileset' },
25+
{ text: 'Colorizer', link: '/configuration/colorizer' }
3626
],
3727
},
3828
{
@@ -56,6 +46,13 @@ export default defineConfig({
5646
{ text: 'ColorInfo', link: '/userdata/colorinfo' },
5747
],
5848
},
49+
{
50+
text: 'Other',
51+
items: [
52+
{ text: 'Pseudotiles', link: '/other/pseudotiles' },
53+
{ text: 'Recipes', link: '/other/recipes' }
54+
],
55+
}
5956
],
6057

6158
socialLinks: [

docs/configuration/colorizer.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Colorizer
3+
---
4+
5+
# About
6+
`colorizer` is a setting which allows you to recolor the pixels in the output image after it has been generated.
7+
8+
You can do this by setting `colorizer` to either a function or a table.
9+
If you choose a function, that function will be run for every pixel in the output image. This might be what you want! But it can also be a bit slow. Choosing table allows you to create direct color-to-color conversions, which are much faster to execute. You are still able to choose if a color should be recolored using a function, so unless necessary, I would go for the table version.
10+
11+
Whether you write one main function, or a function that only operates on one color, it will need to follow this spec:
12+
- *Input*: one parameter, a [`PixelInfo` object](/userdata/pixelinfo)
13+
- *Output*: one of:
14+
- a hex code, like `"#FF0000"` or `"#FF0000FF"`
15+
- a table with `r`, `g`, `b`, and `a` values. `a` is optional, and will default to `255`
16+
::: details Example
17+
```lua
18+
function (info)
19+
-- interchanges the r, g, and b values
20+
return {
21+
r = info.g,
22+
g = info.b,
23+
b = info.r,
24+
a = info.a
25+
}
26+
end
27+
```
28+
:::
29+
30+
## Ways to set
31+
### Table
32+
A `colorizer` table is a mapping from input color codes -- the left side of the equals sign -- to either another color code, or a function which follows the spec above. `colorizer.default` is treated specially: if this is set, any pixel which doesn't match a color code is fed to the `default`. This is probably most useful as a function, but you can set it to a color code as well if you like.
33+
34+
::: details Example
35+
```lua
36+
colorizer = {
37+
["#000000"] = "#00FF00",
38+
["#FF0000"] = function (info)
39+
-- function logic omitted
40+
return hex_code
41+
end,
42+
43+
default = function (info)
44+
-- function logic omitted
45+
return hex_code
46+
end
47+
}
48+
```
49+
50+
Here black pixels (`"#000000"`) will get mapped to green (`"#00FF00"`), red pixels (`"#FF0000"`) will be set to the result of a function, and everything else will be set to the result of a second function.
51+
:::
52+
::: details Tips and Info
53+
- The fields have to be set using the weird-looking `["#000000"]` because `#` means something in actual lua code. Doing it this way wraps it in a string.
54+
- If you have a color-code variable, perhaps imported from something like a `colorscheme.lua`, and you want to use it on the left side of the `=`, make sure to wrap it in brackets as well. This is not necessary on the right side. A la
55+
```lua
56+
local my_variable = "#00FF00"
57+
local other_var = "#0000FF"
58+
59+
colorizer = {
60+
[my_variable] = other_var
61+
}
62+
```
63+
Otherwise Wavewall will attempt to convert `"my_variable"` to a color and throw an error
64+
- You can include alpha values on both sides as well, for instance `"#FF0000FF"`
65+
66+
:::
67+
### Function
68+
See the example used in the function spec above. Setting `colorizer` this way is essentially the same as setting `colorizer` to a table with only `default` defined.
69+

docs/configuration/output.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: Output
3+
---
4+
5+
# About
6+
The `output` section contains settings related to the output image, as well as some non-tileset-specific generation settings.
7+
8+
## Fields
9+
10+
### `directory` - nil, string
11+
The directory in which to save the generated image.
12+
::: details Nil
13+
If `directory` is nil, it defaults to the configuration directory.
14+
:::
15+
::: details String
16+
A fully expanded path.
17+
18+
::: details Example
19+
`directory = "/home/<user>/directory"` (no trailing slash)
20+
:::
21+
22+
### `filename` - nil, string
23+
What name to give the generated `.png` file.
24+
::: details Nil
25+
If `filename` is nil, it defaults to `result.png`.
26+
:::
27+
::: details String
28+
Any string that can be a valid filename on your operating system.
29+
::: details Example
30+
`filename = "save_file.png"`
31+
:::
32+
33+
### `offset` - nil, bool
34+
Wavewall adds a small amount of offset to where it places the tiles, to create a bit of variance between generations. This setting allows you to disable that behaviour.
35+
36+
::: details Example
37+
```lua
38+
offset = false
39+
```
40+
:::
41+
42+
### `size` - table
43+
Specifies the dimensions of the output image.
44+
45+
**Fields**:
46+
- `height` - positive number
47+
- `width` - positive number
48+
49+
::: details Example
50+
```lua
51+
size = {
52+
width = 1920,
53+
height = 1080
54+
}
55+
```
56+
:::
57+
58+
## Example
59+
```lua
60+
output = {
61+
filename = "not_result.png",
62+
directory = "/home/<user>/some/dir",
63+
size = {
64+
height = 50,
65+
width = 1000
66+
}
67+
}

docs/configuration/tileset.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Tileset
3+
---
4+
5+
# About
6+
The `tileset` section allows you to set which and how tiles should be stitched together.
7+
8+
I recommend defining this in a `tileset.lua` file which is contained in the tileset directory, and then importing it into `wavewall.lua`. This allows tilesets to be easily shareable, and I think that would be really cool to see! But more importantly, the settings probably can't be reused across tilesets, so it makes sense to keep them self-contained.
9+
10+
## Fields
11+
### `info` - table
12+
`info` is basically metadata for the tileset.
13+
14+
**Fields**:
15+
- `name` - string
16+
17+
This has to be the same as the tileset's folder
18+
- `tile_size` - nil, positive number
19+
20+
For now, this is automatically inferred and doesn't need to be set. Stay tuned though!
21+
22+
::: details Example
23+
```lua
24+
tileset = {
25+
info = {
26+
name = "my_tileset"
27+
}
28+
}
29+
```
30+
:::
31+
32+
### `pseudotiles` - nil, table
33+
See [Pseudotiles](/other/pseudotiles)
34+
35+
::: details Example
36+
```lua
37+
tileset = {
38+
pseudotiles = {
39+
tile_a = {
40+
pseudo_a = "90",
41+
pseudo_b = "horizontal"
42+
}
43+
}
44+
}
45+
```
46+
:::
47+
48+
### `recipe` - nil, string
49+
Allows you to specify a recipe to use.
50+
51+
::: details Example
52+
```lua
53+
tileset = {
54+
recipe = "some_recipe"
55+
}
56+
```
57+
:::
58+
59+
### `recipes` - table
60+
See [Recipes](/other/recipes)
61+
62+
::: details Example
63+
```lua
64+
tileset = {
65+
recipes = {
66+
recipe_a = {
67+
tiles = {"tile_a", "tile_b"},
68+
}
69+
recipe_b = {
70+
tiles = {
71+
tile_a = 95,
72+
pseudo_a = 5
73+
}
74+
}
75+
}
76+
}
77+
```
78+
:::

docs/index.md

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,69 @@
11
# About
2-
Wavewall is a highly-configurable tiling wallpaper generator.
2+
Wavewall is a tiling wallpaper generator. It takes small images (referred to as tiles) and stitches them together to form a larger, yet still cohesive image.
3+
4+
Wavewall is designed to provide very high control over the output image. You can pick which tiles to use and how often they should appear, and you're even able to recolor every pixel in the output programmatically to fit an existing aesthetic.
5+
6+
***
7+
8+
# How to use Wavewall
9+
Wavewall is configured using the programming language [lua](https://www.lua.org). If you know it already, great! You'll be excited about the cool stuff this enables wavewall to do. If you don't though, don't worry! Wavewall's configuration is designed to be easy to use even if you've never programmed before. First, check out the [guide](/lua/guide) for the basics, and then get started!
10+
11+
***
12+
13+
# Getting started
14+
First, create the configuration directory. This is either `$XDG_CONFIG_HOME/wavewall`, or `/home/<user>/.config/wavewall`. Then, inside the directory, create the file `wavewall.lua` and a directory for your tileset, along with a `tileset.lua`. It should be like this afterwards:
15+
```
16+
wavewall
17+
├── my_tileset
18+
│ └── tileset.lua
19+
└── wavewall.lua
20+
```
21+
22+
Now we need to add some tiles. At the moment these are required to be `.png` files, and they all need to be the same size. Running `wavewall template <size>` will create a template `.png` of that size, which you can then draw on to your desire (I found [PIXILART](https://www.pixilart.com) worked pretty well). To speed things up, you can alsy try out one of the tilesets I provide on the [github repo](https://github.com/rohrsben/wavewall/tree/main/tilesets). Put the tiles in your tileset directory like so:
23+
24+
```
25+
wavewall
26+
├── my_tileset
27+
│ ├── tile_a.png
28+
│ ├── tile_b.png
29+
│ └── tileset.lua
30+
└── wavewall.lua
31+
```
32+
33+
Once you've got some tiles, you just need a configuration. Inside your `.lua` files insert this text:
34+
::: code-group
35+
```lua [wavewall.lua]
36+
local tileset_config = require("my_tileset.tileset")
37+
38+
return {
39+
output = {
40+
size = {
41+
height = 500, -- or, your monitors resolution here!
42+
width = 500
43+
},
44+
},
45+
46+
tileset = tileset_config
47+
}
48+
```
49+
50+
```lua [tileset.lua]
51+
return {
52+
recipes = {
53+
first_recipe = { }
54+
}
55+
}
56+
```
57+
:::
58+
59+
`first_recipe` has no options, but wavewall will still be able to run. From here, adjust how Wavewall generates your image using the docs!
60+
***
61+
62+
# The Documentation
63+
64+
The sidebar has a few sections. Here's what they mean:
65+
- **Configuration**: this section details which options Wavewall allows you to set, how to set them, and what they do
66+
- **Commands**: Wavewall has a few useful secondary commands, like `wavewall template` from above. This details how to use them and what they do
67+
- **Lua**: Wavewall adds a few functions to the lua environment to make writing tileset configurations easier. This tells you what's been added and how to use them, as well as a simple lua guide.
68+
- **UserData**: explains what the functions that are provided return, and how to use them
69+
- **Other**: some settings require more in-depth explanation. This is their home

0 commit comments

Comments
 (0)