Something went wrong. Try again.
Cross-platform and non-web GUI library for 🦀 Rust powered by 🎨 Skia. freyaui.dev
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940#![cfg_attr( all(not(debug_assertions), target_os = "windows"), windows_subsystem = "windows")]
use std::path::PathBuf;
use freya::{ code_editor::*, prelude::*,};use ropey::Rope;
fn main() { launch(LaunchConfig::default().with_window(WindowConfig::new(app)));}
fn app() -> impl IntoElement { use_init_theme(|| dark_theme().with_dark_code_editor()); let a11y_id = use_a11y(); let editor = use_state(move || { let path = PathBuf::from("./crates/freya-code-editor/src/editor_ui.rs"); let rope = Rope::from_str(&std::fs::read_to_string(&path).unwrap()); let language = EditorLanguage::new( tree_sitter_rust::LANGUAGE, tree_sitter_rust::HIGHLIGHTS_QUERY, ); let mut editor = CodeEditorData::new(rope, language); editor.set_theme(EditorSyntaxTheme { comment: (230, 230, 230).into(), ..EditorSyntaxTheme::dark() }); editor.parse(); editor.measure(14., "Jetbrains Mono"); editor });
CodeEditor::new(editor, a11y_id).background((20, 20, 20))}