先上效果图
修改 Qt Creator 界面字体
注意:是修改 Qt Creator 界面字体样式,并不是编辑器里代码的字体样式。
0.安装 JetBrains Mono 字体(下载解压后打开 font/ttf
文件夹,全选右键安装)
1.新建一个 .css
文件并填写如下内容,然后保存(例如放在:C:\Qt\qtcreator-custom-style\qtcreator-custom-style.css
)
1 2 3
| QWidget { font: 10pt "JetBrains Mono"; }
|
2.找到 Qt Creator 的快捷方式,鼠标右键,选择’快捷方式’页,在’目标’编辑框加上 ’ --stylesheet=刚才新建的 css 文件路径’。
例如:C:\Qt\qtcreator-5.0.2\bin\qtcreator.exe --stylesheet=C:\Qt\qtcreator-custom-style\qtcreator-custom-style.css
修改 Qt Creator 成 OneDark 样式
把 onedark.xml
文件放到 [qtcreator.exe Dir]/../share/qtcreator/styles
目录下
把 OneDark.creatortheme
文件放到 [qtcreator.exe Dir]/../share/qtcreator/themes
目录下
如下图目录:
然后,启动 Qt Creator 打开首选项,如下图所示:
选择 Theme
选择 Color Scheme
onedark.xml
文件内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
| <?xml version="1.0" encoding="UTF-8"?> <style-scheme version="1.0" name="One Dark"> <style name="Text" foreground="#abb2bf" background="#282c34"/> <style name="Link" underlineStyle="SingleUnderline"/> <style name="Selection" background="#3e4451"/> <style name="LineNumber" foreground="#4b5363"/> <style name="SearchResult" background="#324365"/> <style name="SearchResultAlt1" foreground="#000033" background="#b6ccff"/> <style name="SearchResultAlt2" foreground="#330000" background="#ffb6cc"/> <style name="SearchResultContainingFunction" background="#3e4451"/> <style name="SearchScope" background="#3e4451"/> <style name="Parentheses" foreground="#abb2bf" background="#282c34" underlineColor="#61afef" underlineStyle="SingleUnderline"/> <style name="ParenthesesMismatch" foreground="#282c34" background="#c678dd"/> <style name="AutoComplete" background="#3e4451"/> <style name="CurrentLine" background="#3a3f4b"/> <style name="CurrentLineNumber" foreground="#777c87"/> <style name="Occurrences" background="#324365"/> <style name="Occurrences.Unused" underlineColor="#d19a66" underlineStyle="DashUnderline"/> <style name="Occurrences.Rename" background="#e06c75"/> <style name="Number" foreground="#d19a66"/> <style name="String" foreground="#98c379"/> <style name="Type" foreground="#61afef"/> <style name="Namespace" foreground="#61afef"/> <style name="Local"/> <style name="Parameter"/> <style name="Global"/> <style name="Field" foreground="#e06c75"/> <style name="Static" foreground="#61afef" italic="true"/> <style name="VirtualMethod" foreground="#61afef" italic="true"/> <style name="Function" foreground="#61afef"/> <style name="Keyword" foreground="#c678dd"/> <style name="PrimitiveType" foreground="#c678dd"/> <style name="Operator" foreground="#c678dd"/> <style name="Overloaded Operator" foreground="#c678dd"/> <style name="Punctuation"/> <style name="Preprocessor" foreground="#c678dd"/> <style name="Macro" foreground="#61afef"/> <style name="Label" foreground="#e06c75" bold="true"/> <style name="Comment" foreground="#5c6370" italic="true"/> <style name="Doxygen.Comment" foreground="#5c6370" italic="true"/> <style name="Doxygen.Tag" foreground="#61afef"/> <style name="VisualWhitespace" foreground="#3c4049"/> <style name="QmlLocalId" foreground="#61afef"/> <style name="QmlExternalId"/> <style name="QmlTypeId" foreground="#61afef"/> <style name="QmlRootObjectProperty" foreground="#61afef"/> <style name="QmlScopeObjectProperty" foreground="#61afef"/> <style name="QmlExternalObjectProperty"/> <style name="JsScopeVar"/> <style name="JsImportVar" foreground="#d19a66"/> <style name="JsGlobalVar" foreground="#d19a66"/> <style name="QmlStateName" foreground="#61afef"/> <style name="Binding" foreground="#c678dd"/> <style name="DisabledCode" foreground="#5c6370"/> <style name="AddedLine" foreground="#98c379"/> <style name="RemovedLine" foreground="#e06c75"/> <style name="DiffFile" foreground="#61afef"/> <style name="DiffLocation" foreground="#d19a66"/> <style name="DiffFileLine" foreground="#282c34" background="#e5c07b"/> <style name="DiffContextLine" foreground="#282c34" background="#56b6c2"/> <style name="DiffSourceLine" foreground="#282c34" background="#be5046"/> <style name="DiffSourceChar" foreground="#282c34" background="#e06c75"/> <style name="DiffDestLine" foreground="#282c34" background="#789353"/> <style name="DiffDestChar" foreground="#282c34" background="#98c379"/> <style name="LogChangeLine" foreground="#e06c75"/> <style name="LogAuthorName" foreground="#61afef"/> <style name="LogCommitDate" foreground="#98c379"/> <style name="LogCommitHash" foreground="#e06c75"/> <style name="LogCommitSubject"/> <style name="LogDecoration" foreground="#c678dd"/> <style name="Warning" underlineColor="#d19a66" underlineStyle="SingleUnderline"/> <style name="WarningContext" underlineColor="#d19a66" underlineStyle="DotLine"/> <style name="Error" underlineColor="#e06c75" underlineStyle="SingleUnderline"/> <style name="ErrorContext" underlineColor="#e06c75" underlineStyle="DotLine"/> <style name="Declaration"/> <style name="FunctionDefinition"/> <style name="OutputArgument" italic="true"/> <style name="StaticMember"/> <style name="CocoCodeAdded"/> <style name="CocoPartiallyCovered" foreground="#d19a66"/> <style name="CocoNotCovered" foreground="#e06c75"/> <style name="CocoFullyCovered" foreground="#98c379"/> <style name="CocoManuallyValidated" foreground="#61afef"/> <style name="CocoDeadCode" foreground="#c678dd"/> <style name="CocoExecutionCountTooLow" foreground="#e06c75"/> <style name="CocoNotCoveredInfo" foreground="#e06c75"/> <style name="CocoCoveredInfo" foreground="#98c379"/> <style name="CocoManuallyValidatedInfo" foreground="#61afef"/> <style name="LastStyleSentinel"/> </style-scheme>
|
OneDark.creatortheme
文件内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414
| [General] ThemeName=One Dark PreferredStyles=Fusion DefaultTextEditorColorScheme=onedark.xml
[Palette] shadowBackground=ff282c34 text=ffabb2bf textDisabled=99abb2bf textHighlighted=ffd7dae0 toolBarItem=ffabb2bf toolBarItemDisabled=99abb2bf fancyBarsNormalTextColor=ffabb2bf fancyBarsBoldTextColor=ffabb2bf hoverBackground=ff31363f selectedBackground=ff3a3f4b selectedBackgroundText=ffd7dae0 normalBackground=ff282c34 alternateBackground=ff31363f error=ffe06c75 warning=ffe5c07b success=ff98c379 message=ff61afef splitter=ff181a1f textColorLink=ff61afef textColorLinkVisited=ffc678dd backgroundColorDisabled=ff21252b
[Colors]
DSpanelBackground=normalBackground
DSwelcomeScreenBackground=normalBackground DSsubPanelBackground=shadowBackground DSthumbnailBackground=normalBackground DSthumbnailLabelBackground=shadowBackground
DSgreenLight=success DSamberLight=message DSredLight=error
DSinteraction=selectedBackground DSerrorColor=error DSwarningColor=warning DSdisabledColor=textDisabled
DSinteractionHover=hoverBackground
DScontrolBackground=shadowBackground DScontrolBackgroundInteraction=shadowBackground DScontrolBackgroundDisabled=backgroundColorDisabled DScontrolBackgroundGlobalHover=hoverBackground DScontrolBackgroundHover=hoverBackground
DScontrolOutline=splitter DScontrolOutlineInteraction=message DScontrolOutlineDisabled=splitter
DStextColor=text DStextColorDisabled=textDisabled DStextSelectionColor=selectedBackground DStextSelectedTextColor=selectedBackgroundText
DSplaceholderTextColor=textDisabled DSplaceholderTextColorInteraction=textDisabled
DSiconColor=text DSiconColorHover=textHighlighted DSiconColorInteraction=message DSiconColorDisabled=textDisabled DSiconColorSelected=message
DSlinkIndicatorColor=text DSlinkIndicatorColorHover=textHighlighted DSlinkIndicatorColorInteraction=message DSlinkIndicatorColorDisabled=textDisabled
DSpopupBackground=shadowBackground DSpopupOverlayColor=splitter
DSsliderActiveTrack=message DSsliderActiveTrackHover=ff7f7f7f DSsliderActiveTrackFocus=ffaaaaaa DSsliderInactiveTrack=alternateBackground DSsliderInactiveTrackHover=ff505050 DSsliderInactiveTrackFocus=ff7a7a7a DSsliderHandle=ff4b5362 DSsliderHandleHover=ff7a7a7a DSsliderHandleFocus=ff1d545c DSsliderHandleInteraction=ff4b5362
DSscrollBarTrack=normalBackground DSscrollBarHandle=ff4b5362
DSsectionHeadBackground=alternateBackground
DSstateDefaultHighlight=message DSstateSeparatorColor=splitter DSstateBackgroundColor=normalBackground DSstatePreviewOutline=splitter
DSchangedStateText=message
DS3DAxisXColor=error DS3DAxisYColor=success DS3DAxisZColor=message
DSactionBinding=message DSactionAlias=error DSactionKeyframe=warning DSactionJIT=success
DStableHeaderBackground=ffff0000 DStableHeaderText=ff00ff00
DSdockContainerBackground=shadowBackground DSdockContainerSplitter=splitter DSdockAreaBackground=normalBackground
DSdockWidgetBackground=shadowBackground DSdockWidgetSplitter=splitter DSdockWidgetTitleBar=normalBackground
DStitleBarText=text DStitleBarIcon=text DStitleBarButtonHover=30ffffff DStitleBarButtonPress=50ffffff
DStabContainerBackground=shadowBackground DStabSplitter=splitter
DStabInactiveBackground=backgroundColorDisabled DStabInactiveText=text DStabInactiveIcon=text DStabInactiveButtonHover=30ffffff DStabInactiveButtonPress=50ffffff
DStabActiveBackground=normalBackground DStabActiveText=text DStabActiveIcon=text DStabActiveButtonHover=30ffffff DStabActiveButtonPress=50ffffff
DStabFocusBackground=message DStabFocusText=shadowBackground DStabFocusIcon=shadowBackground DStabFocusButtonHover=30ffffff DStabFocusButtonPress=50ffffff
DSnavigatorBranch=text DSnavigatorBranchIndicator=text DSnavigatorItemBackground=normalBackground DSnavigatorItemBackgroundHover=hoverBackground DSnavigatorItemBackgroundSelected=selectedBackground DSnavigatorText=text DSnavigatorTextHover=textHighlighted DSnavigatorTextSelected=message DSnavigatorIcon=text DSnavigatorIconHover=textHighlighted DSnavigatorIconSelected=text DSnavigatorAliasIconChecked=error DSnavigatorDropIndicatorBackground=message DSnavigatorDropIndicatorOutline=message
DSheaderViewBackground=shadowBackground DStableViewAlternateBackground=alternateBackground
DStoolTipBackground=normalBackground DStoolTipOutline=text DStoolTipText=text
DSUnimportedModuleColor=success
DSBackgroundColorAlternate=alternateBackground DSBackgroundColorNormal=normalBackground
BackgroundColorAlternate=alternateBackground BackgroundColorDark=shadowBackground BackgroundColorHover=hoverBackground BackgroundColorNormal=normalBackground BackgroundColorDisabled=backgroundColorDisabled BackgroundColorSelected=selectedBackground BadgeLabelBackgroundColorChecked=text BadgeLabelBackgroundColorUnchecked=text BadgeLabelTextColorChecked=normalBackground BadgeLabelTextColorUnchecked=normalBackground CanceledSearchTextColor=error ComboBoxArrowColor=toolBarItem ComboBoxArrowColorDisabled=toolBarItemDisabled ComboBoxTextColor=fancyBarsNormalTextColor DetailsButtonBackgroundColorHover=hoverBackground DetailsWidgetBackgroundColor=shadowBackground DockWidgetResizeHandleColor=splitter DoubleTabWidget1stSeparatorColor=splitter DoubleTabWidget1stTabActiveTextColor=text DoubleTabWidget1stTabBackgroundColor=normalBackground DoubleTabWidget1stTabInactiveTextColor=text DoubleTabWidget2ndSeparatorColor=toolBarItemDisabled DoubleTabWidget2ndTabActiveTextColor=text DoubleTabWidget2ndTabBackgroundColor=selectedBackground DoubleTabWidget2ndTabInactiveTextColor=text EditorPlaceholderColor=shadowBackground FancyToolBarSeparatorColor=toolBarItemDisabled FancyTabBarBackgroundColor=shadowBackground FancyTabBarSelectedBackgroundColor=selectedBackground FancyTabWidgetDisabledSelectedTextColor=toolBarItemDisabled FancyTabWidgetDisabledUnselectedTextColor=toolBarItemDisabled FancyTabWidgetEnabledSelectedTextColor=fancyBarsBoldTextColor FancyTabWidgetEnabledUnselectedTextColor=fancyBarsBoldTextColor FancyToolButtonHoverColor=hoverBackground FancyToolButtonSelectedColor=selectedBackground FutureProgressBackgroundColor=shadowBackground IconsBaseColor=toolBarItem IconsDisabledColor=toolBarItemDisabled IconsInfoColor=message IconsInfoToolBarColor=message IconsWarningColor=warning IconsWarningToolBarColor=warning IconsErrorColor=error IconsErrorToolBarColor=error IconsRunColor=success IconsRunToolBarColor=success IconsStopColor=error IconsStopToolBarColor=error IconsInterruptColor=message IconsInterruptToolBarColor=message IconsDebugColor=toolBarItem IconsNavigationArrowsColor=warning IconsBuildHammerHandleColor=b06112 IconsBuildHammerHeadColor=toolBarItem IconsModeWelcomeActiveColor=success IconsModeEditActiveColor=message IconsModeDesignActiveColor=warning IconsModeDebugActiveColor=message IconsModeProjectActiveColor=success IconsModeAnalyzeActiveColor=message IconsModeHelpActiveColor=warning IconsCodeModelKeywordColor=ff777777 IconsCodeModelClassColor=ffc0b550 IconsCodeModelStructColor=ff53b053 IconsCodeModelFunctionColor=ffd34373 IconsCodeModelVariableColor=ff2bbbcc IconsCodeModelEnumColor=ffc0b550 IconsCodeModelMacroColor=ff476ba0 IconsCodeModelAttributeColor=ff316511 IconsCodeModelUniformColor=ff994899 IconsCodeModelVaryingColor=ffa08833 IconsCodeModelOverlayBackgroundColor=normalBackground IconsCodeModelOverlayForegroundColor=text InfoBarBackground=shadowBackground InfoBarText=text MenuBarEmptyAreaBackgroundColor=shadowBackground MenuBarItemBackgroundColor=shadowBackground MenuBarItemTextColorDisabled=textDisabled MenuBarItemTextColorNormal=text MenuItemTextColorDisabled=textDisabled MenuItemTextColorNormal=text MiniProjectTargetSelectorBackgroundColor=shadowBackground MiniProjectTargetSelectorBorderColor=shadowBackground MiniProjectTargetSelectorSummaryBackgroundColor=normalBackground MiniProjectTargetSelectorTextColor=fancyBarsNormalTextColor PanelStatusBarBackgroundColor=shadowBackground PanelsWidgetSeparatorLineColor=splitter PanelTextColorDark=text PanelTextColorMid=text PanelTextColorLight=textHighlighted ProgressBarColorError=error ProgressBarColorFinished=success ProgressBarColorNormal=message ProgressBarTitleColor=text ProgressBarBackgroundColor=alternateBackground SplitterColor=splitter TextColorDisabled=textDisabled TextColorError=error TextColorHighlight=textHighlighted TextColorHighlightBackground=hoverBackground TextColorLink=textColorLink TextColorLinkVisited=textColorLinkVisited TextColorNormal=text ToggleButtonBackgroundColor=shadowBackground ToolBarBackgroundColor=shadowBackground TreeViewArrowColorNormal=hoverBackground TreeViewArrowColorSelected=text
OutputPanes_DebugTextColor=text OutputPanes_ErrorMessageTextColor=error OutputPanes_MessageOutput=message OutputPanes_NormalMessageTextColor=text OutputPanes_StdErrTextColor=error OutputPanes_StdOutTextColor=text OutputPanes_WarningMessageTextColor=warning OutputPanes_TestPassTextColor=success OutputPanes_TestFailTextColor=error OutputPanes_TestXFailTextColor=error OutputPanes_TestXPassTextColor=message OutputPanes_TestSkipTextColor=message OutputPanes_TestWarnTextColor=warning OutputPanes_TestFatalTextColor=error OutputPanes_TestDebugTextColor=text OutputPaneButtonFlashColor=error OutputPaneToggleButtonTextColorChecked=fancyBarsNormalTextColor OutputPaneToggleButtonTextColorUnchecked=fancyBarsNormalTextColor
Debugger_LogWindow_LogInput=ff56b6c2 Debugger_LogWindow_LogStatus=message Debugger_LogWindow_LogTime=error
Debugger_WatchItem_ValueNormal=text Debugger_WatchItem_ValueInvalid=textDisabled Debugger_WatchItem_ValueChanged=error
Debugger_Breakpoint_TextMarkColor=message
Welcome_TextColor=text Welcome_ForegroundPrimaryColor=text Welcome_ForegroundSecondaryColor=text Welcome_BackgroundColor=normalBackground Welcome_BackgroundPrimaryColor=normalBackground Welcome_BackgroundSecondaryColor=normalBackground Welcome_ButtonBackgroundColor=normalBackground Welcome_DividerColor=splitter Welcome_HoverColor=hoverBackground Welcome_AccentColor=message Welcome_LinkColor=textColorLink Welcome_DisabledLinkColor=textDisabled
Timeline_TextColor=text Timeline_BackgroundColor1=normalBackground Timeline_BackgroundColor2=shadowBackground Timeline_DividerColor=splitter Timeline_HighlightColor=selectedBackground Timeline_PanelBackgroundColor=alternateBackground Timeline_PanelHeaderColor=normalBackground Timeline_HandleColor=ff4b5362 Timeline_RangeColor=selectedBackground
VcsBase_FileStatusUnknown_TextColor=text VcsBase_FileAdded_TextColor=success VcsBase_FileModified_TextColor=warning VcsBase_FileDeleted_TextColor=error VcsBase_FileRenamed_TextColor=message VcsBase_FileUnmerged_TextColor=error
Bookmarks_TextMarkColor=message
TextEditor_SearchResult_ScrollBarColor=success TextEditor_CurrentLine_ScrollBarColor=message
ProjectExplorer_TaskError_TextMarkColor=error ProjectExplorer_TaskWarn_TextMarkColor=warning
CodeModel_Error_TextMarkColor=error CodeModel_Warning_TextMarkColor=warning
QmlDesigner_BackgroundColor=normalBackground QmlDesigner_HighlightColor=selectedBackground QmlDesigner_FormEditorSelectionColor=message QmlDesigner_FormEditorForegroundColor=normalBackground QmlDesigner_BackgroundColorDarkAlternate=normalBackground QmlDesigner_BackgroundColorDarker=splitter QmlDesigner_BorderColor=splitter QmlDesigner_ButtonColor=normalBackground QmlDesigner_TabDark=shadowBackground QmlDesigner_TabLight=text QmlDesigner_FormeditorBackgroundColor=normalBackground QmlDesigner_AlternateBackgroundColor=alternateBackground QmlDesigner_ScrollBarHandleColor=ff4b5362
PaletteWindow=shadowBackground PaletteWindowText=text PaletteBase=normalBackground PaletteAlternateBase=alternateBackground PaletteButton=shadowBackground PaletteBrightText=error PaletteText=text PaletteButtonText=text PaletteButtonTextDisabled=textDisabled PaletteToolTipBase=hoverBackground PaletteHighlight=selectedBackground PaletteDark=shadowBackground PaletteHighlightedText=selectedBackgroundText PaletteToolTipText=text PaletteLink=textColorLink PaletteLinkVisited=textColorLinkVisited PaletteWindowDisabled=backgroundColorDisabled PaletteWindowTextDisabled=textDisabled PaletteBaseDisabled=backgroundColorDisabled PaletteTextDisabled=textDisabled PaletteMid=text PalettePlaceholderText=textDisabled
[Flags] ComboBoxDrawTextShadow=false DerivePaletteFromTheme=true DrawIndicatorBranch=true DrawSearchResultWidgetFrame=false DrawTargetSelectorBottom=false DrawToolBarHighlights=false DrawToolBarBorders=false ApplyThemePaletteGlobally=true FlatToolBars=true FlatSideBarIcons=true FlatProjectsMode=true FlatMenuBar=true ToolBarIconShadow=true WindowColorAsBase=true DarkUserInterface=true
[Gradients] DetailsWidgetHeaderGradient\1\color=normalBackground DetailsWidgetHeaderGradient\1\pos=1 DetailsWidgetHeaderGradient\size=1
|