楼主: oliyiyi
1217 4

Make RStudio Look the Way You Want — Because Beauty Matters [推广有奖]

版主

泰斗

0%

还不是VIP/贵宾

-

TA的文库  其他...

计量文库

威望
7
论坛币
271951 个
通用积分
31269.3519
学术水平
1435 点
热心指数
1554 点
信用等级
1345 点
经验
383775 点
帖子
9598
精华
66
在线时间
5468 小时
注册时间
2007-5-21
最后登录
2024-4-18

初级学术勋章 初级热心勋章 初级信用勋章 中级信用勋章 中级学术勋章 中级热心勋章 高级热心勋章 高级学术勋章 高级信用勋章 特级热心勋章 特级学术勋章 特级信用勋章

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币


(This article was first published on r-bloggers – STATWORX, and kindly contributed to R-bloggers)
Introduction

RStudio is a powerful IDE that helped me so many times with conveniently debugging large and complex R programs as well as shiny apps, but there is one thing that bugs me about it: there is no easy option or interface in RStudio that lets you customize your theme, just as you can do in more developed text editors such as Atom or Sublime. This is sad, especially if you like working with RStudio but are not satisfied with its appearance. That being said, I did some research on how to customize its themes by hand with a little hack! Here you go!

Customizing your theme

Well, before we get started, I've got some sad news for you: first, I use a Mac, so all the instructions pertain to that platform. However, I think things should work similarly when having Windows on your computer. Second, you have to sacrifice one of RStudio's built-in editor themes, so choose wisely. In the end, what we will do is overwriting the settings of one theme with your own preferences. For the sake of demonstration, I will do that with the dawn editor theme in RStudio version 1.1.419. To understand what will be going on, be aware that the RStudio IDE in fact works like a browser and the styles and themes you have at your hand are essentially css files lying somewhere in your file system. We will eventually access those files and change them.

First step: Change a theme until you like it

Let's go now and look at the dawn theme.

Now, if you want to experiment with changing it, recall that RStudio actually is a browser, so right-clicking somewhere in the text editor and selecting "Inspect Element" should open the HTML the editor is based on.


Scroll down until you find the tag referencing a css file. There is a path in the href argument. You should remember the filename of the corresponding css file, because we will change that file on our file system later. Simply click on the path to the css file to view its content.

Perfect! Now, you can mess around with the css selectors' attributes and view the result on the theme in real time (unfortunately, you cannot rearrange the selectors)! As an example, I will change the selector .ace_comment which defines the physical appearance of comments in the code. Let's say I don't like it being italic and I want to change the color to be a bit more … noticeable. That's why I decide to make the font bold and change the color to red. Furthermore, I add another attribute font-size to make the text larger.

This is what it looked like before …

… and this is what it looks like now ….

Second step: Overwrite the theme on your file system

So far, we have temporarily changed the theme. If you reopen RStudio, everything is gone. This can be handy if you just want to play around. However, we want to make things permanent, which is our next step.

As I have already mentioned, an editor theme in RStudio essentially is a css file lying somewhere on your computer, so all R themes can be accessed through your file system. Simply navigate on the program folder with your finder, right-click on the RStudio logo and click on "show package content" (or something similar to that; sorry, my system language is German ;)).

You should now find yourself in the directory Contents. Next, navigate to the css files as shown below

If you change the file corresponding to the dawn theme (97D3C…9C49C5.cache.css), you will have permanently changed that theme.

Conclusion

Customizing RStudio themes requires some little tricks, but it is definitely doable. Please keep in mind that any changes you make when inspecting the editor theme will only be temporary. To make changes permanent, take a look at what theme you want to overwrite, search its corresponding css file name, and enter your changes there.

If you like the Atom theme "One Dark" and you would like to have it as a RStudio theme, you can find it on my GitHub account. Simply rename it to the css file you want to replace and put it in RStudio's theme folder. As a little teaser: this is what it looks like:

About the Author
Tobias KrabelTobias ist im Data Science Team und absolviert im Moment seinen 2. Master in Informatik. In seiner Freizeit ist er sozial engagiert und geht gerne Wandern in der Natur.



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:RStudio Matters Because Beauty Studio

缺少币币的网友请访问有奖回帖集合
https://bbs.pinggu.org/thread-3990750-1-1.html
沙发
pika44 发表于 2018-4-30 09:32:22 |只看作者 |坛友微信交流群
支持一下
已有 1 人评分论坛币 收起 理由
oliyiyi + 3 精彩帖子

总评分: 论坛币 + 3   查看全部评分

使用道具

藤椅
20115326 学生认证  发表于 2018-4-30 10:18:12 |只看作者 |坛友微信交流群
支持一下
已有 1 人评分论坛币 收起 理由
oliyiyi + 3 精彩帖子

总评分: 论坛币 + 3   查看全部评分

使用道具

板凳
minixi 发表于 2018-4-30 11:19:02 |只看作者 |坛友微信交流群
谢谢分享
已有 1 人评分论坛币 收起 理由
oliyiyi + 3 精彩帖子

总评分: 论坛币 + 3   查看全部评分

使用道具

报纸
piiroja 发表于 2020-4-14 05:24:52 |只看作者 |坛友微信交流群
thx for sharing~

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-23 17:30