diff --git a/bin/assets/ui/breeze.css b/bin/assets/ui/breeze.css index e2ef57e3b..f1692d0b2 100644 --- a/bin/assets/ui/breeze.css +++ b/bin/assets/ui/breeze.css @@ -39,6 +39,104 @@ --win-icon: #dbdbdd; } +@media (prefers-color-scheme: light) { + +:root { + --primary: #3daee9; + --back: #fcfcfc; + --font: #232627; + --font-hint: #232627; + --button-back: #eff0f1; + --button-border: #6b6f73; + --button-radius: 2dp; + --base-horizontal-padding: 5dp; + --base-vertical-padding: 5dp; + --border-width: 1dp; + --list-back: #eff0f1; + --separator: #383a3d; + --item-hover: #93cee9; + --scroll-button: #6b6d6f; + --slider-back: #676a6e; + --slider-button: #31363b; + --slider-border: #787b80; + --scrollbar-border: #373a3d; + --scrollbar-button: #4085a9; + --scrollbar-hback-hover: #606365; + --tab-back: #eff0f1; + --tab-line: #616569; + --tab-active: #fcfcfc; + --tab-hover: #93cee9; + --tab-close: #909396; + --tab-close-hover: #863d47; + --icon: #232627; + --icon-active: #3daee9; + --icon-back-hover: #eff0f1; + --icon-line-hover: #3d4246; + --icon-back-alert: #e49aa2; + --menu-back: #eff0f1; + --menu-font: #232627; + --menu-border: #616569; + --menu-font-active: #fcfcfc; + --menu-font-disabled: #6e7275; + --win-icon: #232627; +} + +Menu::Item:selected, +Menu::CheckBox:selected, +Menu::SubMenu:selected, +Menu::RadioButton:selected, +Menu::Item:hover > Menu::Item::text, +Menu::Item:hover > Menu::Item::shortcut, +Menu::CheckBox:hover > Menu::CheckBox::text, +Menu::CheckBox:hover > Menu::CheckBox::shortcut, +Menu::RadioButton:hover > Menu::RadioButton::text, +Menu::RadioButton:hover > Menu::RadioButton::shortcut, +Menu::SubMenu:hover > Menu::SubMenu::text, +Menu::item:hover > Menu::Item::icon, +Menu::item:hover > Menu::SubMenu::icon, +Menu::item:hover > Menu::CheckBox::icon, +Menu::item:hover > Menu::RadioButton::icon, +PushButton:pressed > PushButton::icon, +SelectButton:pressed > SelectButton::icon, +SelectButton:selected > SelectButton::icon, +SelectButton:selectedpressed > SelectButton::icon { + color: var(--menu-font-active); + tint: var(--menu-font-active); +} + +tableview::cell::text, +treeview::cell::text, +listview::cell::text { + color: var(--font); +} + +Tab:selected, +Tab:hover, +Tab:pressed { + color: var(--font); +} + +pushbutton::icon, +selectbutton::icon, +tableview::cell::icon, +treeview::cell::icon, +treeview::cell::expander, +listview::cell::icon { + color: var(--font); + tint: var(--font); +} + +Tab:not(:selected):hover { + color: var(--menu-font-active); +} + +Tooltip { + background-color: var(--font)!important; + color: var(--back)!important; +} + +} + CheckBox, ComboBox, ComboBox::DropDownList::ListBox::item, @@ -112,8 +210,10 @@ SelectButton:selectedpressed { PushButton::icon, SelectButton::icon, +TableView::cell::icon, TreeView::cell::icon, -TreeView::cell::expander { +TreeView::cell::expander, +ListView::cell::icon { margin-right: 4dp; } @@ -476,7 +576,7 @@ Tab::close { height: 10dp; border-radius: 5dp; background-color: var(--tab-close); - foreground-image: poly(line, var(--tab-hover), "0dp 0dp, 5dp 5dp"), poly(line, var(--icon-line-hover), "5dp 0dp, 0dp 5dp"); + foreground-image: poly(line, var(--icon-line-hover), "0dp 0dp, 5dp 5dp"), poly(line, var(--icon-line-hover), "5dp 0dp, 0dp 5dp"); foreground-position: 2.5dp 2.5dp, 2.5dp 2.5dp; margin-right: 4dp; transition: all 0.15s; @@ -678,10 +778,7 @@ Menu::Item:hover > Menu::Item::text, Menu::CheckBox:hover > Menu::Item::text, Menu::RadioButton:hover > Menu::Item::text, Menu::SubMenu:hover > Menu::Item::text, -ListBox::item:hover, -Tab:selected, -Tab:hover, -Tab:pressed { +ListBox::item:hover { color: var(--menu-font-active); } @@ -705,6 +802,7 @@ Menu::SubMenu::icon, Menu::CheckBox::icon, Menu::RadioButton::icon { margin-right: 4dp; + tint: var(--font); } Menu::CheckBox::icon { @@ -882,3 +980,13 @@ ScrollBarMini::hbutton:hover { .appbackground { background-color: var(--back); } + + +@media screen and (min-pixel-density: 1.1) and (max-pixel-density: 1.99) { + +Menu::Separator { + height: 3px; + background-size: 100% 1px; +} + +} diff --git a/docs/articles/cssspecification.md b/docs/articles/cssspecification.md index b3ab1ef78..b2915b7fc 100644 --- a/docs/articles/cssspecification.md +++ b/docs/articles/cssspecification.md @@ -2145,7 +2145,16 @@ The following at-rules are currently supported: [color](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color), [color-index](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/color-index), [monochrome](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/monochrome), - [resolution](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution). + [resolution](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution), + [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme). + Note: eepp prefers dark as default. + + non-standard media features: + *pixel-density*: + The `pixel-density` feature is specified as a `float` value representing the current pixel density + used by the application. It is a range feature, meaning that you can also use the prefixed + min-pixel-density and max-pixel-density variants to query minimum and maximum values, respectively. + Also, eepp only uses `screen` media type. * [@font-face](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face) — diff --git a/include/eepp/ui/css/mediaquery.hpp b/include/eepp/ui/css/mediaquery.hpp index 103ef0691..74c1153fd 100644 --- a/include/eepp/ui/css/mediaquery.hpp +++ b/include/eepp/ui/css/mediaquery.hpp @@ -59,6 +59,12 @@ enum MediaFeature { media_feature_resolution, media_feature_min_resolution, media_feature_max_resolution, + + media_feature_pixel_density, + media_feature_min_pixel_density, + media_feature_max_pixel_density, + + media_feature_prefers_color_scheme, }; enum MediaType { @@ -96,16 +102,21 @@ struct MediaFeatures { // device does not use a color lookup table, the value is zero. int monochrome; // The number of bits per pixel in a monochrome frame buffer. If the device is // not a monochrome device, the output device value will be 0. - int resolution; // The resolution of the output device (in DPI) + int resolution; // The resolution of the output device (in DPI) + float pixelDensity; // Screen pixel density + std::string prefersColorScheme{ "dark" }; // Color Scheme Default Preference }; struct EE_API MediaQueryExpression { typedef std::vector vector; MediaFeature feature; - int val; - int val2; - bool checkAsBool; + int val{ 0 }; + int val2{ 0 }; + float fval{ 0 }; + float fval2{ 0 }; + bool checkAsBool{ false }; + std::string valStr; MediaQueryExpression(); diff --git a/include/eepp/ui/keyboardshortcut.hpp b/include/eepp/ui/keyboardshortcut.hpp index 1302c0aef..8cafaae22 100644 --- a/include/eepp/ui/keyboardshortcut.hpp +++ b/include/eepp/ui/keyboardshortcut.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include using namespace EE::Window; @@ -42,6 +43,10 @@ class EE_API KeyBindings { void addKeybinds( const std::map& binds ); + void addKeybindsStringUnordered( const std::unordered_map& binds ); + + void addKeybindsUnordered( const std::unordered_map& binds ); + void addKeybindString( const std::string& keys, const std::string& command ); void addKeybind( const Shortcut& keys, const std::string& command ); diff --git a/include/eepp/ui/uiscenenode.hpp b/include/eepp/ui/uiscenenode.hpp index 055194bc6..51cccdcd6 100644 --- a/include/eepp/ui/uiscenenode.hpp +++ b/include/eepp/ui/uiscenenode.hpp @@ -22,6 +22,8 @@ class UIWidget; class UILayout; class UIIcon; +enum class ColorSchemePreference { Light, Dark }; + class EE_API UISceneNode : public SceneNode { public: static UISceneNode* New( EE::Window::Window* window = NULL ); @@ -133,6 +135,10 @@ class EE_API UISceneNode : public SceneNode { UIEventDispatcher* getUIEventDispatcher() const; + ColorSchemePreference getColorSchemePreference() const; + + void setColorSchemePreference( const ColorSchemePreference& colorSchemePreference ); + protected: friend class EE::UI::UIWindow; friend class EE::UI::UIWidget; @@ -155,6 +161,7 @@ class EE_API UISceneNode : public SceneNode { std::unordered_map mDirtyStyleStateCSSAnimations; std::unordered_set mDirtyLayouts; std::vector> mTimes; + ColorSchemePreference mColorSchemePreference{ ColorSchemePreference::Dark }; virtual void resizeNode( EE::Window::Window* win ); diff --git a/include/eepp/ui/uiwidget.hpp b/include/eepp/ui/uiwidget.hpp index f10ec1616..a978bea9a 100644 --- a/include/eepp/ui/uiwidget.hpp +++ b/include/eepp/ui/uiwidget.hpp @@ -241,6 +241,8 @@ class EE_API UIWidget : public UINode { UIWidget* getNextTabWidget() const; + bool hasPseudoClass( const std::string& pseudoCls ) const; + protected: friend class UIManager; friend class UISceneNode; diff --git a/src/eepp/ui/css/mediaquery.cpp b/src/eepp/ui/css/mediaquery.cpp index 8a5ef7b9e..624012652 100644 --- a/src/eepp/ui/css/mediaquery.cpp +++ b/src/eepp/ui/css/mediaquery.cpp @@ -16,7 +16,7 @@ namespace EE { namespace UI { namespace CSS { "aspect-ratio;min-aspect-ratio;max-aspect-ratio;device-aspect-ratio;min-device-aspect-" \ "ratio;max-device-aspect-ratio;color;min-color;max-color;color-index;min-color-index;max-" \ "color-index;monochrome;min-monochrome;max-monochrome;resolution;min-resolution;max-" \ - "resolution" + "resolution;pixel-density;min-pixel-density;max-pixel-density;prefers-color-scheme" #define MediaTypeStrings "none;all;screen;print;braille;embossed;handheld;projection;speech;tty;tv" @@ -77,15 +77,23 @@ MediaQuery::ptr MediaQuery::parse( const std::string& str ) { String::trimInPlace( val2 ); int intVal1, intVal2; + float fVal1, fVal2; if ( String::fromString( intVal1, val1 ) && String::fromString( intVal2, val2 ) ) { expr.val = intVal1; expr.val2 = intVal2; } + + if ( String::fromString( fVal1, val1 ) && + String::fromString( fVal2, val2 ) ) { + expr.fval = fVal1; + expr.fval2 = fVal2; + } } else { StyleSheetLength length = StyleSheetLength::fromString( exprTokens[1] ); + expr.valStr = String::trim( String::toLower( exprTokens[1] ) ); if ( length.getUnit() == StyleSheetLength::Unit::Dpcm || length.getUnit() == StyleSheetLength::Unit::Dpi ) { @@ -93,6 +101,8 @@ MediaQuery::ptr MediaQuery::parse( const std::string& str ) { } else { expr.val = (int)length.asPixels( 0, Sizef::Zero, dpi ); } + + expr.fval = length.getValue(); } } } @@ -382,6 +392,22 @@ bool MediaQueryExpression::check( const MediaFeatures& features ) const { return true; } break; + case media_feature_pixel_density: + if ( features.pixelDensity == val ) + return true; + break; + case media_feature_min_pixel_density: + if ( features.pixelDensity >= fval ) + return true; + break; + case media_feature_max_pixel_density: + if ( features.pixelDensity <= fval ) + return true; + break; + case media_feature_prefers_color_scheme: + if ( features.prefersColorScheme == valStr ) + return true; + break; default: return false; } diff --git a/src/eepp/ui/css/stylesheetselectorrule.cpp b/src/eepp/ui/css/stylesheetselectorrule.cpp index 3ebadc027..1d40e6107 100644 --- a/src/eepp/ui/css/stylesheetselectorrule.cpp +++ b/src/eepp/ui/css/stylesheetselectorrule.cpp @@ -4,9 +4,9 @@ namespace EE { namespace UI { namespace CSS { -static const char* StatePseudoClasses[] = {"normal", "focus", "selected", - "hover", "pressed", "selectedhover", - "selectedpressed", "disabled"}; +static const char* StatePseudoClasses[] = { "normal", "focus", "selected", + "hover", "pressed", "selectedhover", + "selectedpressed", "disabled" }; static bool isPseudoClassState( const std::string& pseudoClass ) { for ( Uint32 i = 0; i < eeARRAY_SIZE( StatePseudoClasses ); i++ ) { @@ -20,7 +20,7 @@ static bool isPseudoClassState( const std::string& pseudoClass ) { static const char* StructuralPseudoClasses[] = { "checked", "disabled", "empty", "enabled", "first-child", "first-of-type", "last-child", "last-of-type", "not", "nth-child", - "nth-last-child", "nth-last-of-type", "nth-of-type", "only-of-type", "only-child"}; + "nth-last-child", "nth-last-of-type", "nth-of-type", "only-of-type", "only-child" }; static bool isStructuralPseudoClass( const std::string& pseudoClass ) { for ( Uint32 i = 0; i < eeARRAY_SIZE( StructuralPseudoClasses ); i++ ) { @@ -35,10 +35,17 @@ static void splitSelectorPseudoClass( const std::string& selector, std::string& std::string& realPseudoClass ) { if ( !selector.empty() ) { bool lastWasColon = false; + bool inFunction = false; for ( int i = (Int32)selector.size() - 1; i >= 0; i-- ) { char curChar = selector[i]; + if ( inFunction && curChar == '(' ) + inFunction = false; + + if ( inFunction ) + continue; + if ( lastWasColon ) { if ( StyleSheetSelectorRule::PSEUDO_CLASS == curChar ) { // no pseudo class @@ -56,6 +63,11 @@ static void splitSelectorPseudoClass( const std::string& selector, std::string& } else if ( StyleSheetSelectorRule::PSEUDO_CLASS == curChar ) { lastWasColon = true; } + + if ( curChar == ')' ) { + inFunction = true; + lastWasColon = false; + } } if ( lastWasColon ) { diff --git a/src/eepp/ui/css/stylesheetspecification.cpp b/src/eepp/ui/css/stylesheetspecification.cpp index 7e433265c..6b2e7edfa 100644 --- a/src/eepp/ui/css/stylesheetspecification.cpp +++ b/src/eepp/ui/css/stylesheetspecification.cpp @@ -523,6 +523,10 @@ void StyleSheetSpecification::registerDefaultNodeSelectors() { if ( node->getId() == param.substr( 1 ) ) { return false; } + } else if ( param[0] == ':' ) { + if ( node->hasPseudoClass( param.substr( 1 ) ) ) { + return false; + } } else { if ( node->getElementTag() == String::toLower( param ) ) { return false; diff --git a/src/eepp/ui/keyboardshortcut.cpp b/src/eepp/ui/keyboardshortcut.cpp index c521b9817..5a92184c4 100644 --- a/src/eepp/ui/keyboardshortcut.cpp +++ b/src/eepp/ui/keyboardshortcut.cpp @@ -67,6 +67,20 @@ void KeyBindings::addKeybinds( const std::map& binds ) { + for ( auto& bind : binds ) { + addKeybindString( bind.first, bind.second ); + } +} + +void KeyBindings::addKeybindsUnordered( + const std::unordered_map& binds ) { + for ( auto& bind : binds ) { + addKeybind( bind.first, bind.second ); + } +} + void KeyBindings::addKeybindString( const std::string& keys, const std::string& command ) { addKeybind( getShortcutFromString( keys ), command ); } diff --git a/src/eepp/ui/uicodeeditor.cpp b/src/eepp/ui/uicodeeditor.cpp index cfc75785a..3f46ee9d6 100644 --- a/src/eepp/ui/uicodeeditor.cpp +++ b/src/eepp/ui/uicodeeditor.cpp @@ -809,7 +809,7 @@ void UICodeEditor::createDefaultContextMenuOptions( UIPopUpMenu* menu ) { menuAdd( menu, "cut", "Cut", "cut", "cut" ); menuAdd( menu, "copy", "Copy", "copy", "copy" ); menuAdd( menu, "cut", "Paste", "paste", "paste" ); - menuAdd( menu, "delete", "Delete", "delete", "delete-to-next-char" ); + menuAdd( menu, "delete", "Delete", "delete-text", "delete-to-next-char" ); menu->addSeparator(); menuAdd( menu, "select_all", "Select All", "select-all", "select-all" ); diff --git a/src/eepp/ui/uipushbutton.cpp b/src/eepp/ui/uipushbutton.cpp index f9b19923b..87f008efc 100644 --- a/src/eepp/ui/uipushbutton.cpp +++ b/src/eepp/ui/uipushbutton.cpp @@ -28,7 +28,7 @@ UIPushButton::UIPushButton( const std::string& tag, UIWidget( tag ), mIcon( NULL ), mTextBox( NULL ) { mFlags |= ( UI_AUTO_SIZE | UI_VALIGN_CENTER | UI_HALIGN_CENTER ); - mIcon = UIImage::NewWithTag( "pushbutton::icon" ); + mIcon = UIImage::NewWithTag( tag + "::icon" ); mIcon->setScaleType( UIScaleType::FitInside ) ->setLayoutSizePolicy( SizePolicy::Fixed, SizePolicy::Fixed ) ->setFlags( UI_VALIGN_CENTER | UI_HALIGN_CENTER ) @@ -43,7 +43,7 @@ UIPushButton::UIPushButton( const std::string& tag, mIcon->addEventListener( Event::OnSizeChange, cb ); mIcon->addEventListener( Event::OnVisibleChange, cb ); - mTextBox = newTextViewCb ? newTextViewCb() : UITextView::NewWithTag( "pushbutton::text" ); + mTextBox = newTextViewCb ? newTextViewCb() : UITextView::NewWithTag( tag + "::text" ); mTextBox->setLayoutSizePolicy( SizePolicy::WrapContent, SizePolicy::WrapContent ) ->setFlags( UI_VALIGN_CENTER | UI_HALIGN_CENTER ) ->setParent( this ) diff --git a/src/eepp/ui/uiscenenode.cpp b/src/eepp/ui/uiscenenode.cpp index e3937a920..cdb6462f5 100644 --- a/src/eepp/ui/uiscenenode.cpp +++ b/src/eepp/ui/uiscenenode.cpp @@ -698,6 +698,9 @@ bool UISceneNode::onMediaChanged() { media.monochrome = 0; media.colorIndex = 256; media.resolution = static_cast( getDPI() ); + media.pixelDensity = PixelDensity::getPixelDensity(); + media.prefersColorScheme = + mColorSchemePreference == ColorSchemePreference::Dark ? "dark" : "light"; if ( mStyleSheet.updateMediaLists( media ) ) { mRoot->reportStyleStateChangeRecursive(); @@ -854,4 +857,15 @@ UIEventDispatcher* UISceneNode::getUIEventDispatcher() const { return static_cast( mEventDispatcher ); } +ColorSchemePreference UISceneNode::getColorSchemePreference() const { + return mColorSchemePreference; +} + +void UISceneNode::setColorSchemePreference( const ColorSchemePreference& colorSchemePreference ) { + if ( mColorSchemePreference != colorSchemePreference ) { + mColorSchemePreference = colorSchemePreference; + onMediaChanged(); + } +} + }} // namespace EE::UI diff --git a/src/eepp/ui/uiwidget.cpp b/src/eepp/ui/uiwidget.cpp index 8ed60ebfb..240b80b36 100644 --- a/src/eepp/ui/uiwidget.cpp +++ b/src/eepp/ui/uiwidget.cpp @@ -932,6 +932,11 @@ bool UIWidget::hasClass( const std::string& cls ) const { return std::find( mClasses.begin(), mClasses.end(), cls ) != mClasses.end(); } +bool UIWidget::hasPseudoClass( const std::string& pseudoCls ) const { + return std::find( mPseudoClasses.begin(), mPseudoClasses.end(), pseudoCls ) != + mPseudoClasses.end(); +} + void UIWidget::setElementTag( const std::string& tag ) { if ( mTag != tag ) { mTag = tag; diff --git a/src/tools/codeeditor/codeeditor.cpp b/src/tools/codeeditor/codeeditor.cpp index 1bbc378d4..d8267093a 100644 --- a/src/tools/codeeditor/codeeditor.cpp +++ b/src/tools/codeeditor/codeeditor.cpp @@ -1040,12 +1040,12 @@ void App::loadKeybindings() { auto defKeybindings = getDefaultKeybindings(); IniFile ini( mKeybindingsPath ); if ( FileSystem::fileExists( mKeybindingsPath ) ) { - mKeybindings = ini.getKeyMap( "keybindings" ); + mKeybindings = ini.getKeyUnorderedMap( "keybindings" ); } else { for ( const auto& it : defKeybindings ) ini.setValue( "keybindings", bindings.getShortcutString( it.first ), it.second ); ini.writeFile(); - mKeybindings = ini.getKeyMap( "keybindings" ); + mKeybindings = ini.getKeyUnorderedMap( "keybindings" ); } for ( const auto& key : mKeybindings ) mKeybindingsInvert[key.second] = key.first; @@ -1454,7 +1454,7 @@ void App::onCodeEditorCreated( UICodeEditor* editor, TextDocument& doc ) { loadKeybindings(); mEditorSplitter->forEachEditor( [&]( UICodeEditor* ed ) { ed->getKeyBindings().reset(); - ed->getKeyBindings().addKeybindsString( mKeybindings ); + ed->getKeyBindings().addKeybindsStringUnordered( mKeybindings ); } ); } if ( !editor->getDocument().hasSyntaxDefinition() ) { @@ -1481,7 +1481,7 @@ void App::onCodeEditorCreated( UICodeEditor* editor, TextDocument& doc ) { if ( !mKeybindings.empty() ) { editor->getKeyBindings().reset(); - editor->getKeyBindings().addKeybindsString( mKeybindings ); + editor->getKeyBindings().addKeybindsStringUnordered( mKeybindings ); } editor->addEventListener( Event::OnDocumentClosed, [&]( const Event* event ) { @@ -2071,7 +2071,8 @@ FontTrueType* App::loadFont( const std::string& name, std::string fontPath, return FontTrueType::New( name, fontPath ); } -void App::init( const std::string& file, const Float& pidelDensity ) { +void App::init( const std::string& file, const Float& pidelDensity, + const std::string& colorScheme ) { DisplayManager* displayManager = Engine::instance()->getDisplayManager(); Display* currentDisplay = displayManager->getDisplayIndex( 0 ); mDisplayDPI = currentDisplay->getDPI(); @@ -2135,6 +2136,8 @@ void App::init( const std::string& file, const Float& pidelDensity ) { PixelDensity::setPixelDensity( eemax( mWindow->getScale(), mConfig.window.pixelDensity ) ); mUISceneNode = UISceneNode::New(); + if ( colorScheme == "light" ) + mUISceneNode->setColorSchemePreference( ColorSchemePreference::Light ); mFont = loadFont( "sans-serif", mConfig.ui.serifFont, "assets/fonts/NotoSans-Regular.ttf" ); mFontMono = @@ -2393,6 +2396,7 @@ void App::init( const std::string& file, const Float& pidelDensity ) { { "file-edit", 0xecdb }, { "font-size", 0xed8d }, { "delete-bin", 0xec1e }, + { "delete-text", 0xec1e }, { "zoom-in", 0xf2db }, { "zoom-out", 0xf2dd }, { "zoom-reset", 0xeb47 }, @@ -2500,6 +2504,9 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { args::ValueFlag pixelDenstiyConf( parser, "pixel-density", "Set default application pixel density", { 'd', "pixel-density" } ); + args::ValueFlag prefersColorScheme( + parser, "prefers-color-scheme", "Set the preferred color scheme (\"light\" or \"dark\")", + { 'c', "prefers-color-scheme" } ); try { parser.ParseCLI( argc, argv ); @@ -2517,7 +2524,8 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { } appInstance = eeNew( App, () ); - appInstance->init( file.Get(), pixelDenstiyConf ? pixelDenstiyConf.Get() : 0.f ); + appInstance->init( file.Get(), pixelDenstiyConf ? pixelDenstiyConf.Get() : 0.f, + prefersColorScheme ? prefersColorScheme.Get() : "dark" ); eeSAFE_DELETE( appInstance ); Engine::destroySingleton(); diff --git a/src/tools/codeeditor/codeeditor.hpp b/src/tools/codeeditor/codeeditor.hpp index 214ee6682..0f6c822b3 100644 --- a/src/tools/codeeditor/codeeditor.hpp +++ b/src/tools/codeeditor/codeeditor.hpp @@ -24,7 +24,7 @@ class App : public UICodeEditorSplitter::Client { ~App(); - void init( const std::string& file, const Float& pidelDensity ); + void init( const std::string& file, const Float& pidelDensity, const std::string& colorScheme ); void setAppTitle( const std::string& title ); @@ -97,8 +97,8 @@ class App : public UICodeEditorSplitter::Client { UITabWidget* mSidePanel{ nullptr }; UICodeEditorSplitter* mEditorSplitter{ nullptr }; std::string mInitColorScheme; - std::map mKeybindings; - std::map mKeybindingsInvert; + std::unordered_map mKeybindings; + std::unordered_map mKeybindingsInvert; std::string mConfigPath; std::string mKeybindingsPath; Float mDisplayDPI{ 96 };