mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 10:56:20 +00:00
Merge pull request #8524 from penpot/azazeln28-feat-text-editor-theme-conf
🎉 Text Editor v3 theme conf
This commit is contained in:
commit
ffae6d4281
@ -66,7 +66,7 @@ fn render_selection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut paint = Paint::default();
|
let mut paint = Paint::default();
|
||||||
paint.set_blend_mode(BlendMode::Multiply);
|
paint.set_blend_mode(BlendMode::default());
|
||||||
paint.set_color(editor_state.theme.selection_color);
|
paint.set_color(editor_state.theme.selection_color);
|
||||||
paint.set_anti_alias(true);
|
paint.set_anti_alias(true);
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ pub enum TextEditorEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// FIXME: It should be better to get these constants from the frontend through the API.
|
/// FIXME: It should be better to get these constants from the frontend through the API.
|
||||||
const SELECTION_COLOR: Color = Color::from_argb(255, 0, 209, 184);
|
const SELECTION_COLOR: Color = Color::from_argb(127, 0, 209, 184);
|
||||||
const CURSOR_WIDTH: f32 = 1.5;
|
const CURSOR_WIDTH: f32 = 1.5;
|
||||||
const CURSOR_COLOR: Color = Color::BLACK;
|
const CURSOR_COLOR: Color = Color::BLACK;
|
||||||
const CURSOR_BLINK_INTERVAL_MS: f64 = 530.0;
|
const CURSOR_BLINK_INTERVAL_MS: f64 = 530.0;
|
||||||
|
|||||||
@ -6,6 +6,7 @@ use crate::utils::uuid_from_u32_quartet;
|
|||||||
use crate::utils::uuid_to_u32_quartet;
|
use crate::utils::uuid_to_u32_quartet;
|
||||||
use crate::{with_state, with_state_mut, STATE};
|
use crate::{with_state, with_state_mut, STATE};
|
||||||
use macros::ToJs;
|
use macros::ToJs;
|
||||||
|
use skia_safe::Color;
|
||||||
|
|
||||||
#[derive(PartialEq, ToJs)]
|
#[derive(PartialEq, ToJs)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
@ -23,6 +24,21 @@ pub enum CursorDirection {
|
|||||||
// STATE MANAGEMENT
|
// STATE MANAGEMENT
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
#[no_mangle]
|
||||||
|
pub extern "C" fn text_editor_apply_theme(
|
||||||
|
selection_color: u32,
|
||||||
|
cursor_width: f32,
|
||||||
|
cursor_color: u32,
|
||||||
|
) {
|
||||||
|
with_state_mut!(state, {
|
||||||
|
// NOTE: In the future could be interesting to fill al this data from
|
||||||
|
// a structure pointer.
|
||||||
|
state.text_editor_state.theme.selection_color = Color::new(selection_color);
|
||||||
|
state.text_editor_state.theme.cursor_width = cursor_width;
|
||||||
|
state.text_editor_state.theme.cursor_color = Color::new(cursor_color);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn text_editor_start(a: u32, b: u32, c: u32, d: u32) -> bool {
|
pub extern "C" fn text_editor_start(a: u32, b: u32, c: u32, d: u32) -> bool {
|
||||||
with_state_mut!(state, {
|
with_state_mut!(state, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user