查看原文
其他

给你的RStudio换一个炫酷的主题吧!

阿越就是我 医学和生信笔记 2023-02-25
关注公众号,发送R语言,获取学习资料!

     Try to learn everything about something! 


今天给大家介绍一些好看的Rstudio主题!

默认的Rstudio已经自带了很多主题,可以自由选择。

但是有的小伙伴并不满足于此,今天就给大家介绍一些其他的好看的主题。


  • rsthemes

    • 安装

    • 使用方法

    • 其他功能

  • rstudiothemes

  • RStudio官方支持


rsthemes

国外大佬维护的一个Rstudio主题扩展包,直接下载安装即可,对网络有要求。

功能非常全面,除了提供主题外,还提供以下功能:

  • 自动转换light/dark主题:设定时间,自动转换
  • 在你喜欢的几个主题间自动切换
  • 变回默认主题

下面是一个动图展示所有支持的主题:




安装

首先是安装主题包:

install.packages(
  "rsthemes",
  repos = c(gadenbuie = 'https://gadenbuie.r-universe.dev', getOption("repos"))
)

# 或者
# install.packages("devtools")
devtools::install_github("gadenbuie/rsthemes")

使用方法

使用主题:一句代码即可:

rstudioapi::applyTheme("One Dark {rsthemes}")

首先查看下有哪些主题:

# 21个主题
rsthemes::list_rsthemes()

 [1"a11y-dark {rsthemes}"                    
 [2"a11y-light {rsthemes}"                   
 [3"Fairyfloss {rsthemes}"                   
 [4"Flat White {rsthemes}"                   
 [5"GitHub {rsthemes}"                       
 [6"Horizon Dark {rsthemes}"                 
 [7"Material Darker {rsthemes}"              
 [8"Material Lighter {rsthemes}"             
 [9"Material Ocean {rsthemes}"               
[10"Material Palenight {rsthemes}"           
[11"Material {rsthemes}"                     
[12"Night Owl {rsthemes}"                    
[13"Nord Polar Night Aurora {rsthemes}"      
[14"Nord Snow Storm {rsthemes}"              
[15"Oceanic Plus {rsthemes}"                 
[16"One Dark {rsthemes}"                     
[17"One Light {rsthemes}"                    
[18"Solarized Dark {rsthemes}"               
[19"Solarized Light {rsthemes}"              
[20"Yule RStudio (Reduced Motion) {rsthemes}"
[21"Yule RStudio {rsthemes}"    

尝试不同的主题:

# 尝试所有主题
rsthemes::try_rsthemes()

# 尝试不同风格主题,light,dark,base16 themes等
rsthemes::try_rsthemes("light")

其他功能

按时自动切换主题(这个功能我没用过,小伙伴可以自行测试下)。

把下面这段代码加入到你的.Rprofile中:

if (interactive() && requireNamespace("rsthemes", quietly = TRUE)) {
  # 选择你喜欢的主题
  rsthemes::set_theme_light("One Light {rsthemes}")  # light theme
  rsthemes::set_theme_dark("One Dark {rsthemes}"# dark theme

  setHook("rstudio.sessionInit"function(isNewSession) {
    # 自动切换主题
    rsthemes::use_theme_auto(dark_start = "18:00", dark_end = "6:00")
  }, action = "append")
}

这个R包还有很多其他功能,刚兴趣的可以到Github[1]自行查看哦!

rstudiothemes

这是一个国外大佬维护的github仓库,收集了很多优秀的rstudio主题,每个主题都给出了相应的链接,点击链接即可查看详细情况。




这是Github链接[2]

大家可以根据自己的喜好选择喜欢的主题替换即可。

RStudio官方支持

RStudio官方也提供了很多扩展主题,也是非常好看,同时给出了如何自己编写主题等内容,大家可以自行查看。

RStudio官方支持[3]

参考资料

[1]

rsthemes: https://github.com/gadenbuie/rsthemes

[2]

rstudiothemes: https://github.com/mkearney/rstudiothemes

[3]

RStudio官方支持: https://www.rstudio.com/blog/rstudio-ide-custom-theme-support/


以上就是今天的内容,希望对你有帮助哦!欢迎点赞、在看、关注、转发

欢迎在评论区留言或直接添加我的微信!


欢迎关注公众号:医学和生信笔记

医学和生信笔记 公众号主要分享:1.医学小知识、肛肠科小知识;2.R语言和Python相关的数据分析、可视化、机器学习等;3.生物信息学学习资料和自己的学习笔记!


往期回顾




R语言画好看的聚类树

2022-01-05

R语言可视化聚类树

2022-01-01

使用R语言美化PCA

2021-12-30

R语言生信表学习之网络图

2022-01-08

你还不会画网络图

2022-03-17

您可能也对以下帖子感兴趣

文章有问题?点此查看未经处理的缓存