วันศุกร์ที่ 2 มิถุนายน พ.ศ. 2566

เปลี่ยนสีและ Weight ของ Text ใน Arduino IDE ผ่าน Theme

ไฟล์ theme.txt จะอยู่ใน C:/Program Files (x86)/Arduino/lib/theme ซึ่งจะต้องใช้สิทธิ์ Administrator ในการแก้ไขไฟล์ แต่เราสามารถ Copy ไฟล์ theme.txt แล้วเปลี่ยนชื่อไฟล์ theme.txt เดิมเป็นชื่ออื่น เช่น default-theme.txt จากนั้น้ราก็แก้ไขไฟล์ theme.txt ได้โดยไม่จำเป็นต้องใช้สิทธิ์ Administrator


ส่วนที่ 1 Keywords

# TEXT - KEYWORDS

# FUNCTIONS
editor.keyword1.style = #E06C75,bold
editor.data_type.style = #E06C75,bold          บรรทัดนี้คือคำสั่ง Serial, WiFi, etc. 
                                                                       ซึ่งเป็น Built-in library

# METHODS
editor.keyword2.style = #E06C75,plain
editor.function.style = #61AFEF,plain             บรรทัดนี้คือคำสั่ง begin, init, print, 
                                                                        println, delay, millis, pinMode, 
                                                                        digitalWrite, etc.

# STRUCTURES
editor.keyword3.style = #C678DD,plain
editor.reserved_word.style = #C678DD,plain บรรทัดนี้คือคำสั่ง setup, loop, 
                                                                                while, if, else, return, etc.

ส่วนที่ 2 Literals

# TEXT - LITERALS

# constants & datatypes
editor.literal1.style = #61AFEF,plain                    

# p5 built in variables: e.g. mouseX, width, pixels
editor.literal2.style = #61AFEF,plain
editor.variable.style = #61AFEF,plain
editor.reserved_word_2.style = #61AFEF,plain        บรรทัดนี้คือคำสั่ง const, 
                                                                                  unsigned, int, long, void, 
                                                                                  float, string, HIGH, LOW, 
                                                                                  OUTPUT, etc.

editor.literal_boolean.style = #61AFEF,plain           บรรทัดนี้คือ boolean variable
editor.literal_char.style = #61AFEF,plain   บรรทัดนี้คือ char varible

บรรทัดนี้คือ string variable
editor.literal_string_double_quote.style = #61AFEF,plain    

บรรทัดนี้คือคำสั่ง #inclide, define, etc.
editor.preprocessor.style = #98C379,plain


หลังจากแก้ไขเสร็จแล้วให้ Save ไฟล์ theme.txt แล้วเปิด Arduino IDE ขึ้นมาใหม่ ก็จะพบว่าสีหรือ Weight ของ Text ใน Editor มีการเปลี่ยนแปลง