From b5f9bf05f3a15ef17f88093c1544ef28bf789ecc Mon Sep 17 00:00:00 2001 From: Miika Alonen Date: Sat, 16 Dec 2023 14:36:43 +0200 Subject: [PATCH] Add getThemes() method --- src/API.ts | 7 ++++++- .../patterns/ziffers/ziffers_syncing.ts | 16 ++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/API.ts b/src/API.ts index e19ff21..8f5032d 100644 --- a/src/API.ts +++ b/src/API.ts @@ -2279,8 +2279,13 @@ export class UserAPI { } public randomTheme = (): void => { - let theme_names = Object.keys(colorschemes); + let theme_names = this.getThemes(); let selected_theme = theme_names[Math.floor(Math.random() * theme_names.length)]; this.app.readTheme(selected_theme); } + + public getThemes = (): string[] => { + return Object.keys(colorschemes); + } + } diff --git a/src/documentation/patterns/ziffers/ziffers_syncing.ts b/src/documentation/patterns/ziffers/ziffers_syncing.ts index 70b3003..ccd4396 100644 --- a/src/documentation/patterns/ziffers/ziffers_syncing.ts +++ b/src/documentation/patterns/ziffers/ziffers_syncing.ts @@ -12,14 +12,14 @@ Ziffers patterns can be synced to any event by using **cue**, **sync**, **wait** The cue(name: string) methods can be used to send cue messages for ziffers patterns. The wait(name: string) method is used to wait for the cue message to be received before starting the next cycle. - ${makeExample( - "Sending cue from event and wait", - ` - beat(4.0) :: sound("bd").cue("foo").out(); - z1("e 0 3 2 1 2 1").wait("foo").sound("sine").out(); - `, - true, - )} +${makeExample( +"Sending cue from event and wait", +` +beat(4.0) :: sound("bd").cue("foo").out() +z1("e 0 3 2 1 2 1").wait("foo").sound("sine").out() +`, +true, +)} The sync(name: string) method is used to sync the ziffers pattern to the cue message.