RKTK API Docs RKTK Home Repo

rktk/hooks/interface/
rgb.rs

1use crate::drivers::interface::rgb::*;
2
3/// Hooks related to RGB functionality.
4///
5/// This trait allows for custom RGB behavior to be implemented.
6/// These hooks are called in both master and slave sides of the keyboard.
7pub trait RgbHooks: 'static {
8    /// Invoked after the RGB driver is initialized.
9    ///
10    /// * `_driver`: [`RgbDriver`] instance to control RGB.
11    /// * `_is_master`: If true, this is the master side of the keyboard.
12    async fn on_rgb_init(&mut self, _driver: &mut impl RgbDriver, _is_master: bool) {}
13
14    /// Invoked
15    /// - after the [`RgbCommand`] is send and RGB task received it
16    /// - before the RGB task processes the command.
17    ///
18    /// You can use this hook to modify the RGB mode before the RGB task processes.
19    ///
20    /// * `_driver`: [`RgbDriver`] instance to control RGB.
21    /// * `_rgb_mode`: [`RgbMode`] to be processed.
22    async fn on_rgb_process(&mut self, _driver: &mut impl RgbDriver, _rgb_mode: &mut RgbMode) {}
23    async fn custom_rgb(&mut self, _driver: &mut impl RgbDriver, _brightness: f32) {}
24}