Files
clide/src/gui/colors.rs
2026-02-21 21:10:12 -05:00

116 lines
4.6 KiB
Rust

// SPDX-FileCopyrightText: 2026, Shaun Reed <shaunrd0@gmail.com>
//
// SPDX-License-Identifier: GNU General Public License v3.0 or later
use cxx_qt_lib::QColor;
use libclide::theme::colors::Colors;
#[cxx_qt::bridge]
pub mod qobject {
unsafe extern "C++" {
include!("cxx-qt-lib/qcolor.h");
type QColor = cxx_qt_lib::QColor;
}
unsafe extern "RustQt" {
#[qobject]
#[qml_element]
#[qml_singleton]
#[qproperty(QColor, hovered)]
#[qproperty(QColor, unhovered)]
#[qproperty(QColor, pressed)]
#[qproperty(QColor, menubar)]
#[qproperty(QColor, menubar_border)]
#[qproperty(QColor, scrollbar)]
#[qproperty(QColor, scrollbar_active)]
#[qproperty(QColor, scrollbar_gutter)]
#[qproperty(QColor, linenumber)]
#[qproperty(QColor, active)]
#[qproperty(QColor, inactive)]
#[qproperty(QColor, editor_background)]
#[qproperty(QColor, editor_text)]
#[qproperty(QColor, editor_highlighted_text)]
#[qproperty(QColor, editor_highlight)]
#[qproperty(QColor, gutter)]
#[qproperty(QColor, explorer_hovered)]
#[qproperty(QColor, explorer_text)]
#[qproperty(QColor, explorer_text_selected)]
#[qproperty(QColor, explorer_background)]
#[qproperty(QColor, explorer_folder)]
#[qproperty(QColor, explorer_folder_open)]
#[qproperty(QColor, terminal_background)]
#[qproperty(QColor, info_log)]
#[qproperty(QColor, debug_log)]
#[qproperty(QColor, warn_log)]
#[qproperty(QColor, error_log)]
#[qproperty(QColor, trace_log)]
type RustColors = super::RustColorsImpl;
}
}
pub struct RustColorsImpl {
hovered: QColor,
unhovered: QColor,
pressed: QColor,
menubar: QColor,
menubar_border: QColor,
scrollbar: QColor,
scrollbar_active: QColor,
scrollbar_gutter: QColor,
linenumber: QColor,
active: QColor,
inactive: QColor,
editor_background: QColor,
editor_text: QColor,
editor_highlighted_text: QColor,
editor_highlight: QColor,
gutter: QColor,
explorer_hovered: QColor,
explorer_text: QColor,
explorer_text_selected: QColor,
explorer_background: QColor,
explorer_folder: QColor,
explorer_folder_open: QColor,
terminal_background: QColor,
info_log: QColor,
debug_log: QColor,
warn_log: QColor,
error_log: QColor,
trace_log: QColor,
}
impl Default for RustColorsImpl {
fn default() -> Self {
Self {
hovered: QColor::try_from(Colors::HOVERED).unwrap(),
unhovered: QColor::try_from(Colors::UNHOVERED).unwrap(),
pressed: QColor::try_from(Colors::PRESSED).unwrap(),
menubar: QColor::try_from(Colors::MENUBAR).unwrap(),
menubar_border: QColor::try_from(Colors::MENUBAR_BORDER).unwrap(),
scrollbar: QColor::try_from(Colors::SCROLLBAR).unwrap(),
scrollbar_active: QColor::try_from(Colors::SCROLLBAR_ACTIVE).unwrap(),
scrollbar_gutter: QColor::try_from(Colors::SCROLLBAR_GUTTER).unwrap(),
linenumber: QColor::try_from(Colors::LINENUMBER).unwrap(),
active: QColor::try_from(Colors::ACTIVE).unwrap(),
inactive: QColor::try_from(Colors::INACTIVE).unwrap(),
editor_background: QColor::try_from(Colors::EDITOR_BACKGROUND).unwrap(),
editor_text: QColor::try_from(Colors::EDITOR_TEXT).unwrap(),
editor_highlighted_text: QColor::try_from(Colors::EDITOR_HIGHLIGHTED_TEXT).unwrap(),
editor_highlight: QColor::try_from(Colors::EDITOR_HIGHLIGHT).unwrap(),
gutter: QColor::try_from(Colors::GUTTER).unwrap(),
explorer_hovered: QColor::try_from(Colors::EXPLORER_HOVERED).unwrap(),
explorer_text: QColor::try_from(Colors::EXPLORER_TEXT).unwrap(),
explorer_text_selected: QColor::try_from(Colors::EXPLORER_TEXT_SELECTED).unwrap(),
explorer_background: QColor::try_from(Colors::EXPLORER_BACKGROUND).unwrap(),
explorer_folder: QColor::try_from(Colors::EXPLORER_FOLDER).unwrap(),
explorer_folder_open: QColor::try_from(Colors::EXPLORER_FOLDER_OPEN).unwrap(),
terminal_background: QColor::try_from(Colors::TERMINAL_BACKGROUND).unwrap(),
info_log: QColor::try_from(Colors::INFO_LOG).unwrap(),
debug_log: QColor::try_from(Colors::DEBUG_LOG).unwrap(),
warn_log: QColor::try_from(Colors::WARN_LOG).unwrap(),
error_log: QColor::try_from(Colors::ERROR_LOG).unwrap(),
trace_log: QColor::try_from(Colors::TRACE_LOG).unwrap(),
}
}
}