Skip to content

Complete Command documentation #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
298 changes: 200 additions & 98 deletions api/app_command.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions api/command/AddColor.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ app.command.AddColor {
}
```

Adds a new color into the palette.
Adds a new color to the palette.

* `source`: Can be `"fg"`, `"bg"`, or `"color"` (default). To add the foreground, background, or a specific color respectively.
* `color`: A [Color](../color.md#color) instance to add too the palette.
* `color`: A [Color](../color.md#color) instance to add to the palette.

## Example

Expand Down
11 changes: 11 additions & 0 deletions api/command/AutocropSprite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# AutocropSprite

```lua
app.command.AutocropSprite {
byGrid=bool
}
```

Automatically crops the sprite.

* `byGrid`: Aligns the crop to the grid. Optional, defaults to `false`.
10 changes: 4 additions & 6 deletions api/command/BrightnessContrast.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

```lua
app.command.BrightnessContrast {
ui=true,
ui=bool,
channels=FilterChannels...,
brightness=0,
contrast=0
brightness=int,
contrast=int
}
```

* `ui`: Shows the dialog on the screen, `true` by default. Set to
`false` for automatic change brightness and/or contrast without
asking to the user for the change.
* `ui`: Shows the brightness dialog, `true` by default. Set to `false` to apply the changes immediately without user input or preview.
* `channels`: A combination of [FilterChannels](../filterchannels.md#filterchannels) with
[bitwise OR (`|`) operator](https://www.lua.org/manual/5.3/manual.html#3.4.2).
By default it is equal to:
Expand Down
12 changes: 6 additions & 6 deletions api/command/CanvasSize.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

```lua
app.command.CanvasSize {
ui=true,
left=0,
top=0,
right=0,
bottom=0,
ui=bool,
left=int,
top=int,
right=int,
bottom=int,
bounds=Rectangle,
trimOutside=false
trimOutside=bool
}
```

Expand Down
2 changes: 1 addition & 1 deletion api/command/CelOpacity.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

```lua
app.command.CelOpacity {
opacity = 0
opacity=int
}
```

Expand Down
14 changes: 14 additions & 0 deletions api/command/ChangeBrush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ChangeBrush

```lua
app.command.ChangeBrush {
change=string
slot=int
}
```

Changes the brush of the active tool

* `change`: Can be: "increment-size", "decrement-size", "increment-angle", "decrement-angle", "flip-x", "flip-y", "flip-d", "rotate-90cw", "custom"
* `slot`: Custom brush slot (optional, only for "custom" change)

13 changes: 13 additions & 0 deletions api/command/ChangeColor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ChangeColor

```lua
app.command.ChangeColor {
target=string
change=string
}
```

Changes the current foreground or background color by moving up or down on the palette by index.

* `target`: Can be `"foreground"` or `"background"`
* `change`: Can be `"increment-index"` or `"decrement-index"`
19 changes: 10 additions & 9 deletions api/command/ChangePixelFormat.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ app.command.ChangePixelFormat {
dithering=string,
["dithering-matrix"]=string,
rgbmap=string,
toGray=string
toGray=string,
fitCriteria=string
}
```

Changes the [ColorMode](../colormode.md) of the active [sprite](../sprite.md)

* `format`: Can be `"rgb"`, `"gray"`, or `"indexed"`.
* `dithering`: Can be `"ordered"`, `"old"` `"error-diffusion"`,
or empty.
* `dithering-matrix`: It can be `"bayer8x8"`, `"bayer4x4"`, or `"bayer2x2"` (when When `dithering` is `ordered` or `old`).
Actually it can be a matrix ID from any extensions ([for example](https://github.com/aseprite/aseprite/blob/fc79146c56f941f834f28809f0d2c4d7fd60076c/data/extensions/bayer-matrices/package.json#L8)).
* `rgmap`: `"octree"`, `"rgb5a3"`, or `"default"` (generally default
* `format`: `"rgb"`, `"gray"`, or `"indexed"`.
* `dithering`: Optional, `"ordered"`, `"old"` `"error-diffusion"`
* `dithering-matrix`: Optional, `"bayer8x8"`, `"bayer4x4"`, or `"bayer2x2"` (when When `dithering` is `ordered` or `old`).
Actually it can be a matrix ID from any extension ([for example](https://github.com/aseprite/aseprite/blob/fc79146c56f941f834f28809f0d2c4d7fd60076c/data/extensions/bayer-matrices/package.json#L8)).
* `rgbmap`: Optional, `"octree"`, `"rgb5a3"`, or `"default"` (generally default
will be octree, but it might change in the future). If nothing is
specified the default configured quantization method from prefereces
specified the default configured quantization method from preferences
will be used if the GUI is enabled.
* `toGray`: `"luma"`, `"hsv"`, or `"hsl"`.
* `toGray`: Optional, `"luma"`, `"hsv"`, or `"hsl"`.
* `fitCriteria`: Optional, `"rgb"`, `"linearizedRGB"`, `"ciexyz"`, `"cielab"`, or `"default"`

## Example

Expand Down
5 changes: 2 additions & 3 deletions api/command/ColorCurve.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

```lua
app.command.ColorCurve {
ui=true,
ui=bool,
channels=FilterChannels...,
curve={ Point, Point, Point... }
}
```

* `ui`: Shows the dialog on the screen, `true` by default. Set to
`false` to apply the color curve filter automatically without asking
to the user for the change.
`false` to apply the color curve filter automatically without user input.
* `channels`: A combination of [FilterChannels](../filterchannels.md#filterchannels) with
[bitwise OR (`|`) operator](https://www.lua.org/manual/5.3/manual.html#3.4.2).
By default it is equal to:
Expand Down
30 changes: 30 additions & 0 deletions api/command/ColorQuantization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ColorQuantization

```lua
app.command.ColorQuantization {
ui=bool,
withAlpha=bool,
maxColors=int,
useRange=bool,
algorithm=string,
}
```

Creates a palette from the current sprite

* `ui`: Shows the dialog on the screen, `true` by default.
* `withAlpha`: Create entries with alpha component, defaults to `true`
* `maxColors`: Color amount limit, defaults to `256`
* `useRange`: Replace current range, defaults to `false`
* `algorithm`: One of `"default"`, `"rgb5a3"` or `"octree"`

## Example

```lua
app.command.ColorQuantization {
ui=true,
withAlpha=false,
maxColors=100,
algorithm="octree"
}
```
15 changes: 5 additions & 10 deletions api/command/ConvolutionMatrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,22 @@

```lua
app.command.ConvolutionMatrix {
ui=true,
ui=bool,
channels=FilterChannels...,
tiledMode=none,
tiledMode=string,
fromResource=string
}
```

* `ui`: Shows the dialog on the screen, `true` by default. Set to
`false` to apply the convolution matrix filter automatically without
asking to the user for the change.
* `ui`: Shows the dialog on the screen, `true` by default. Set to `false` to apply the convolution matrix filter automatically without asking to the user for confirmation.
* `channels`: A combination of [FilterChannels](../filterchannels.md#filterchannels) with
[bitwise OR (`|`) operator](https://www.lua.org/manual/5.3/manual.html#3.4.2).
By default it is equal to:
[FilterChannels.RED](../filterchannels.md#filterchannelsred) |
[FilterChannels.GREEN](../filterchannels.md#filterchannelsgreen) |
[FilterChannels.BLUE](../filterchannels.md#filterchannelsblue) |
[FilterChannels.GRAY](../filterchannels.md#filterchannelsgray).
* `tiledMode`: `'none'`, `'x'`, `'y'`, `'both'`. By default it's
`'none'` if there is no UI, or it's equal to `app.preferences.document(app.sprite).tiled.mode`
when `ui` is `true`.
* `tiledMode`: `'none'`, `'x'`, `'y'`, `'both'`. Defaults to `'none'` if there is no UI, or it's equal to `app.preferences.document(app.sprite).tiled.mode` when `ui` is `true`.
* `fromResource`: Name of [pre-defined convolution matrix](https://github.com/aseprite/aseprite/blob/a70a3a11c71ae96eb6af3756525182e88129ffcd/data/convmatr.def#L34).

*Note*: In future versions this function should support creating
customized convolution matrices.
*Note*: In future versions this function should support creating customized convolution matrices.
4 changes: 1 addition & 3 deletions api/command/CopyColors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ app.command.CopyColors {
}
```

Copies the range selected colors
[`app.range.colors`](../range.md#rangecolors) before the given
`colorIndex`.
Copies the range selected colors [`app.range.colors`](../range.md#rangecolors) before the given `colorIndex`.
18 changes: 18 additions & 0 deletions api/command/CropSprite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# CropSprite

```lua
app.command.CropSprite {
x=int,
y=int,
width=int,
height=int
}
```

Crops the sprite to the given bounds.
All parameters default to 0, if none are not given, the sprite will be cropped to the mask bounds.

* `x`: The X value of the crop bounds
* `x`: The Y value of the crop bounds
* `width`: The crop width
* `height`: The crop height
14 changes: 7 additions & 7 deletions api/command/Despeckle.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

```lua
app.command.Despeckle {
ui=true,
channels=...,
width=3,
height=3,
tiledMode=none,
ui=bool,
channels=FilterChannels...,
width=int,
height=int,
tiledMode=string,
}
```

Expand All @@ -20,6 +20,6 @@ app.command.Despeckle {
[FilterChannels.GRAY](../filterchannels.md#filterchannelsgray).
* `width`: Width of the convolution matrix to calculate the median. `3` by default.
* `height`: Height of the convolution matrix to calculate the median. `3` by default.
* `tiledMode`: `'none'`, `'x'`, `'y'`, `'both'`. By default it's
`'none'` if there is no UI, or it's equal to `app.preferences.document(app.sprite).tiled.mode`
* `tiledMode`: `"none"`, `"x"`, `"y"`, `"both"`. By default it's
`"none"` if there is no UI, or it's equal to `app.preferences.document(app.sprite).tiled.mode`
when `ui` is `true`.
15 changes: 15 additions & 0 deletions api/command/DuplicateSprite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# DuplicateSprite

```lua
app.command.DuplicateSprite {
ui=bool,
filename=string,
flatten=bool
}
```

Duplicates the current sprite

* `ui`: Shows the duplicate dialog, `true` by default. Set to `false` to create the duplicate automatically.
* `filename`: New filename for the sprite, if left empty it will auto-generate a new one.
* `flatten`: Duplicate merged layers only. Defaults to `false`.
4 changes: 2 additions & 2 deletions api/command/ExportTileset.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
```lua
app.command.ExportTileset {
dataFormat=SpriteSheetDataFormat.JSON_ARRAY,
fromTilesets=true
fromTilesets=bool
}
```

This is similar to
using [the `-export-tileset` argument from the CLI](https://www.aseprite.org/docs/cli/#export-tileset)
with [`-format=json-array` option](https://www.aseprite.org/docs/cli/#format).

This command accept the same parameters as [app.command.SaveFileCopyAs](SaveFile.md#savefile).
This command accepts the same parameters as [app.command.SaveFileCopyAs](SaveFile.md#savefile).
11 changes: 11 additions & 0 deletions api/command/FlattenLayers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# FlattenLayers

```lua
app.command.FlattenLayers {
visibleOnly=bool
}
```

Flattens the current layers into one.

* `visibleOnly`: Set to `true` to only flatten the visible layers, defaults to `false`.
15 changes: 15 additions & 0 deletions api/command/Flip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Flip

```lua
app.command.Flip {
target=string
orientation=string
}
```

Flips the whole sprite or the current selection mask, either vertically or horizontally.

Note: When specifying `target=mask` without a UI or with no active mask, the entire sprite will be flipped.

* `target`: Can be `"mask"` or `"sprite"`. Defaults to "`sprite`".
* `change`: Can be `"vertical"` or `"horizontal"`. Defaults to "`horizontal`".
11 changes: 11 additions & 0 deletions api/command/FrameProperties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# FrameProperties

```lua
app.command.FrameProperties {
frame=string or int
}
```

Shows the Frame Properties dialog

* `target`: Can be `"all"`, `"current"` or the frame number. Defaults to "`all`".
11 changes: 11 additions & 0 deletions api/command/FrameTagProperties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# FrameProperties

```lua
app.command.FrameProperties {
name=string
}
```

Shows the Frame Tag Properties dialog for the given name, or the first tag if no name is given.

`name`: Tag name.
18 changes: 8 additions & 10 deletions api/command/HueSaturation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@

```lua
app.command.HueSaturation {
ui=true,
ui=bool,
channels=FilterChannels...,
mode='hsl',
hue=0,
saturation=0,
lightness=0,
alpha=0
mode=string,
hue=int,
saturation=int,
lightness=int,
alpha=int
}
```

* `ui`: Shows the dialog on the screen, `true` by default. Set to
`false` for automatic change brightness and/or contrast without
asking to the user for the change.
* `ui`: Shows the dialog on the screen, `true` by default. Set to `false` for automatic change brightness and/or contrast without asking the user for confirmation.
* `channels`: A combination of [FilterChannels](../filterchannels.md#filterchannels) with
[bitwise OR (`|`) operator](https://www.lua.org/manual/5.3/manual.html#3.4.2).
By default it is equal to:
[FilterChannels.RED](../filterchannels.md#filterchannelsred) |
[FilterChannels.GREEN](../filterchannels.md#filterchannelsgreen) |
[FilterChannels.BLUE](../filterchannels.md#filterchannelsblue) |
[FilterChannels.GRAY](../filterchannels.md#filterchannelsgray).
* `mode`: `'hsl'` (default) or `'hsv'`
* `mode`: `"hsl"` (default) or `"hsv"`
* `hue`: From `-180` to `180`
* `saturation`: From `-100` to `100`
* `lightness` (or `value`): From `-100` to `100`
Expand Down
Loading