ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

如何在 Qt Creator 中应用 one dark pro 主题

2021-12-14 10:04:10  阅读:296  来源: 互联网

标签:Code Qt Creator pro 主题 dark


前言

Qt Creator 自带了几款主题,但是并不好看。在博客 《Qt Creator打造VScode one dark pro主题配色》 中给出了 one dark pro 主题的配置文件,但是效果并不好,所以这里给出改进后的主题文件(只针对代码部分)。

配置文件

D:\Qt\Tools\QtCreator\share\qtcreator\styles 中创建一个 onedark.xml 文件,然后在文件里面写入以下内容:

<?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="SearchScope" background="#3e4451"/>
  <style name="Parentheses" underlineColor="#61afef" underlineStyle="SingleUnderline"/>
  <style name="ParenthesesMismatch" foreground="#000000" background="#c678dd"/>
  <style name="AutoComplete" background="#3e4451"/>
  <style name="CurrentLine" background="#3a3f4b"/>
  <style name="CurrentLineNumber" foreground="#abb2bf" />
  <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="Local" foreground="#e06c75" />
  <style name="Parameter" foreground="#e06c75" />
  <style name="Global" foreground="#e06c75" />
  <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="Type" foreground="#e5c07b" />
  <style name="Operator" foreground="#56b6c2" />
  <style name="Overloaded Operator" foreground="#c678dd"/>
  <style name="Punctuation"/>
  <style name="Preprocessor" foreground="#c678dd"/>
  <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="#000000" background="#e5c07b"/>
  <style name="DiffContextLine" foreground="#000000" background="#56b6c2"/>
  <style name="DiffSourceLine" foreground="#000000" background="#be5046"/>
  <style name="DiffSourceChar" foreground="#000000" background="#e06c75"/>
  <style name="DiffDestLine" foreground="#000000" background="#789353"/>
  <style name="DiffDestChar" foreground="#000000" 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="LastStyleSentinel"/>
</style-scheme>

然后在 Qt Creator 中的 工具 --> 选项 --> 文本编辑器 中将主题换成 One Dark 即可。重启之后就可以看到代码样式的变化了,至于 Qt Creator 界面的主题可以参照上述博客中的配置。

界面截图

配置完成之后的界面如下图所示,有 VS Code 的 one dark pro 的感觉了,当然代码编辑体验还是差了点,想要完全使用 VS Code 来开发 Qt 的话可以参见之前的博客 《如何在 VS Code 中搭建 Qt 开发环境》

界面

标签:Code,Qt,Creator,pro,主题,dark
来源: https://www.cnblogs.com/zhiyiYo/p/15686411.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有