Skip to content
Snippets Groups Projects
Unverified Commit 28988a5e authored by StaffEngineer's avatar StaffEngineer Committed by GitHub
Browse files

Merge pull request #38 from StaffEngineer/rename_to_text

improve restricted example
parents 092d2425 d0b325eb
No related branches found
No related tags found
No related merge requests found
...@@ -4,8 +4,7 @@ use bevy_cosmic_edit::*; ...@@ -4,8 +4,7 @@ use bevy_cosmic_edit::*;
fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) {
commands.spawn(Camera2dBundle::default()); commands.spawn(Camera2dBundle::default());
let attrs = let attrs = AttrsOwned::new(Attrs::new().color(CosmicColor::rgb(0, 0, 0)));
AttrsOwned::new(Attrs::new().color(bevy_color_to_cosmic(Color::rgb(0.27, 0.27, 0.27))));
let primary_window = windows.single(); let primary_window = windows.single();
let editor = commands let editor = commands
...@@ -39,15 +38,6 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { ...@@ -39,15 +38,6 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) {
commands.insert_resource(Focus(Some(editor))); commands.insert_resource(Focus(Some(editor)));
} }
pub fn bevy_color_to_cosmic(color: bevy::prelude::Color) -> CosmicColor {
cosmic_text::Color::rgba(
(color.r() * 255.) as u8,
(color.g() * 255.) as u8,
(color.b() * 255.) as u8,
(color.a() * 255.) as u8,
)
}
fn main() { fn main() {
App::new() App::new()
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment