Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code Theme Edit PHP

I'm in the process of switching over to VS Code from Notepad++

The number one thing bugging me at the moment is in a file a PHP tag is the same colour coding as a DIV element. I'd like to change the colour of the PHP tags to be some shade of red.

Just using the default VS Dark theme.

TIA

like image 721
OniJoshin Avatar asked Mar 01 '26 01:03

OniJoshin


2 Answers

You can also make this change in your user settings. I included some additional customizations I use to bold function, keywords, etc... These types of changes should be placed in the user settings file rather than customizing a specific theme file - since your changes will be lost when the theme is upgraded.

    "editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": [
                    "punctuation.section.embedded.begin.php",
                    "punctuation.section.embedded.end.php"
                ],
                "settings": {
                    "foreground": "#ff0000"
                }
            },
            {
                "scope": "keyword",
                "settings": {
                    "fontStyle": "bold"
                }
            },
            {
                "scope": "storage",
                "settings": {
                    "fontStyle": "bold"
                }
            },
            {
                "scope": "constant.language",
                "settings": {
                    "fontStyle": "bold"
                }
            },
            {
                "scope": "support.class.builtin",
                "settings": {
                    "fontStyle": "bold"
                }
            }
        ]
    }
like image 80
Tom Avatar answered Mar 02 '26 14:03

Tom


As far as the themes, VS Code is every bit editable.

The file you are looking for is at :

Microsoft VS Code\resources\app\extensions\theme-defaults\themes

on Windows and search for file name dark_vs.json to locate it on any other system.

The section you'd want to change is this :

{
    "scope": [
        "punctuation.section.embedded.begin.php",
        "punctuation.section.embedded.end.php"
    ],
    "settings": {
        "foreground": "#569cd6"
    }
}

Feel free to chante the foreground color to whatever you'd like. You can, as well, modify any other color you'd like.

like image 30
Alexandre Elshobokshy Avatar answered Mar 02 '26 15:03

Alexandre Elshobokshy