diff --git a/CHANGELOG.md b/CHANGELOG.md index dc8367f..c9b880d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - function `undoable({ name, icon }, actionFunction)` to make an action undoable, as far is it modifies the canvas - function `show_error_message(message, [error])` to show an error message dialog box, optionally with expandable error details - function `open_from_file(blob, source_file_handle)` to load a file from a blob and file handle pair (kinda quirky API) +- function `set_theme(theme_file_name)` to switch themes +- function `set_language(language_code)` to switch languages, prompting the user to reload the application - You can use `.main-canvas` selector to access the canvas element. - URL parameter `#load:` to load a file from a URL diff --git a/README.md b/README.md index 0548580..16886df 100644 --- a/README.md +++ b/README.md @@ -703,6 +703,28 @@ Sorry for the quirky API. The API is new, and parts of it have not been designed at all. This was just a hack that I came to depend on, reaching into the internals of JS Paint to load a file. I decided to document it as the first version of the API, since I'll want a changelog when upgrading my usage of it anyways. +#### function `set_theme(theme_file_name)` +[`set_theme`]: #set_theme + +Use this to change the look of the application. + +Arguments: +- `theme_file_name`: the name of the theme file to load, one of: + - `"classic.css"`: the Windows98 theme. + - `"dark.css"`: the Dark theme. + - `"modern.css"`: the Modern theme. + - `"winter.css"`: the festive Winter theme. + - `"occult.css"`: a Satanic theme. + +#### function `set_language(language_code)` +[`set_language`]: #set_language + +You can kind of use this to change the language of the application. But actually it will show a prompt to the user to change the language, because the application needs to reload to apply the change. +And if that dialog isn't in the right language, well, they'll probably be confused. + +Arguments: +- `language_code`: the language code to use, e.g. `"en"` for English, `"zh"` for Traditional Chinese, `"zh-simplified"` for Simplified Chinese, etc. + #### Changelog The API will change a lot, but changes will be documented in the [Changelog](CHANGELOG.md).