Repository: lapce/lapce
File: lapce-ui/src/plugin.rs (Rust)

Code before:
        _data: &LapceTabData,
        _env: &Env,
    ) -> Size {
        bc.max()
    }

    fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
        let size = ctx.size();
        let padding = 10.0;

        ctx.with_save(|ctx| {
            let viewport = ctx.size().to_rect().inflate(-padding, 0.0);
            ctx.clip(viewport);

            if data.plugins.is_empty() {
                let y = self.line_height;
                let x = self.line_height;
                let layout = ctx
                    .text()
                    .new_text_layout("Failed to load plugin information")
                    .font(
                        data.config.ui.font_family(),
                        data.config.ui.font_size() as f64,
                    )
                    .default_attribute(TextAttribute::Weight(FontWeight::SEMI_BOLD))
                    .text_color(Color::from_hex_str("#d29200").unwrap())
                    .build()
                    .unwrap();
                ctx.draw_text(&layout, Point::new(x, y));
                return;
            }

            for (i, plugin) in data.plugins.iter().enumerate() {
                let y = 3.0 * self.line_height * i as f64;
                let x = 3.0 * self.line_height;
                let text_layout = ctx
                    .text()
                    .new_text_layout(plugin.display_name.clone())
                    .font(
                        data.config.ui.font_family(),
                        data.config.ui.font_size() as f64,
                    )
                    .default_attribute(TextAttribute::Weight(FontWeight::BOLD))
                    .text_color(
                        data.config
                            .get_color_unchecked(LapceTheme::EDITOR_FOCUS)
                            .clone(),
                    )
                    .build()
                    .unwrap();
                ctx.draw_text(

Review comment (suggestion):
This should use a color from the theme. Likely `"lapce.warn"` or `"lapce.error"` would work.

Code after:
        _data: &LapceTabData,
        _env: &Env,
    ) -> Size {
        bc.max()
    }

    fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
        let size = ctx.size();
        let padding = 10.0;

        ctx.with_save(|ctx| {
            let viewport = ctx.size().to_rect().inflate(-padding, 0.0);
            ctx.clip(viewport);

            if data.plugins.is_empty() {
                let y = self.line_height;
                let x = self.line_height;
                let layout = ctx
                    .text()
                    .new_text_layout("Failed to load plugin information")
                    .font(
                        data.config.ui.font_family(),
                        data.config.ui.font_size() as f64,
                    )
                    .default_attribute(TextAttribute::Weight(FontWeight::SEMI_BOLD))
                    .text_color(
                        data.config
                            .get_color_unchecked(LapceTheme::LAPCE_WARN)
                            .clone(),
                    )
                    .build()
                    .unwrap();
                ctx.draw_text(&layout, Point::new(x, y));
                return;
            }

            for (i, plugin) in data.plugins.iter().enumerate() {
                let y = 3.0 * self.line_height * i as f64;
                let x = 3.0 * self.line_height;
                let text_layout = ctx
                    .text()
                    .new_text_layout(plugin.display_name.clone())
                    .font(
                        data.config.ui.font_family(),
                        data.config.ui.font_size() as f64,
                    )
                    .default_attribute(TextAttribute::Weight(FontWeight::BOLD))
                    .text_color(
                        data.config
                            .get_color_unchecked(LapceTheme::EDITOR_FOCUS)
                            .clone(),