How to change the MySQL Workbench editor background color?

The editor uses Scintilla and is configured through the file data/code_editor.xml as you guessed.

This file is composed of languages and for every language the styles have to be defined.

To change the text background use id 32 (STYLE_DEFAULT)

Example: <style id="32" back-color="#000000" /> <!-- STYLE_DEFAULT -->

Line numbers background, on the left, can be customized through id 33 (STYLE_LINENUMBER)

The other styles id are for different keywords (described on code_editor.xml comments). For example: Comments background can be changed by adding back-color to id 1 and 2 on language SCLEX_MYSQL.

This has to be done for every language you want to customize.

As far as I know there is no way to change the default globally.

References

  • Scintilla FAQ
  • Scintilla Docs

Taken from here but I changed it so it works in MySQL Workbench 8.0 on Windows 10. Not needed for MacOS since it has integrated Darkmode afaik.

Copy the following into code_editor.xml at the end in <language name="SCLEX_MYSQL">. You'll find this file under C:\Program Files\MySQL\MySQL Workbench 8.0 CE\data or wherever you have Workbench installed.

<style id= "0" fore-color-light="#DDDDDD" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_DEFAULT                  -->
<style id= "1" fore-color-light="#999999" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_COMMENT                  -->
<style id= "2" fore-color-light="#999999" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_COMMENTLINE              -->
<style id= "3" fore-color-light="#DDDDDD" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_VARIABLE                 -->
<style id= "4" fore-color-light="#9B859D" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_SYSTEMVARIABLE           -->
<style id= "5" fore-color-light="#9B859D" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_KNOWNSYSTEMVARIABLE      -->
<style id= "6" fore-color-light="#FF8080" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_NUMBER                   -->
<style id= "7" fore-color-light="#7AAAD7" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_MAJORKEYWORD             -->
<style id= "8" fore-color-light="#7AAAD7" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_KEYWORD                  -->
<style id= "9" fore-color-light="#9B859D" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_DATABASEOBJECT           -->
<style id="10" fore-color-light="#DDDDDD" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_PROCEDUREKEYWORD         -->
<style id="11" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_STRING                   -->
<style id="12" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_SQSTRING                 -->
<style id="13" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_DQSTRING                 -->
<style id="14" fore-color-light="#FFBB80" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_OPERATOR                 -->
<style id="15" fore-color-light="#9B859D" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_FUNCTION                 -->
<style id="16" fore-color-light="#DDDDDD" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_IDENTIFIER               -->
<style id="17" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_QUOTEDIDENTIFIER         -->
<style id="18" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_USER1                    -->
<style id="19" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_USER2                    -->
<style id="20" fore-color-light="#B9CB89" back-color-light="#2A2A2A" bold="No" />   <!-- SCE_MYSQL_USER3                    -->
<style id="21" fore-color-light="#FFBB80" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_HIDDENCOMMAND            -->
<style id="22" fore-color-light="#909090" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_PLACEHOLDER              -->

<!-- These two are for scintilla globally. -->
<style id="32" fore-color-light="#DDDDDD" back-color-light="#2A2A2A" bold="No" />   <!-- STYLE_DEFAULT                      THIS IS THE ONE FOR THE BACKGROUND!!!!! -->
<style id="33" fore-color-light="#2A2A2A" back-color-light="#DDDDDD" bold="No" />   <!-- STYLE_LINENUMBER                   -->

<!-- All styles again in their variant in a hidden command (with a 0x40 offset). -->
<style id="65" fore-color-light="#999999" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_COMMENT                  -->
<style id="66" fore-color-light="#999999" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_COMMENTLINE              -->
<style id="67" fore-color-light="#DDDDDD" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_VARIABLE                 -->
<style id="68" fore-color-light="#9B859D" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_SYSTEMVARIABLE           -->
<style id="69" fore-color-light="#9B859D" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_KNOWNSYSTEMVARIABLE      -->
<style id="70" fore-color-light="#FF8080" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_NUMBER                   -->
<style id="71" fore-color-light="#7AAAD7" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_MAJORKEYWORD             -->
<style id="72" fore-color-light="#7AAAD7" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_KEYWORD                  -->
<style id="73" fore-color-light="#9B859D" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_DATABASEOBJECT           -->
<style id="74" fore-color-light="#DDDDDD" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_PROCEDUREKEYWORD         -->
<style id="75" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_STRING                   -->
<style id="76" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_SQSTRING                 -->
<style id="77" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_DQSTRING                 -->
<style id="78" fore-color-light="#FFBB80" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_OPERATOR                 -->
<style id="79" fore-color-light="#9B859D" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_FUNCTION                 -->
<style id="80" fore-color-light="#DDDDDD" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_IDENTIFIER               -->
<style id="81" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_QUOTEDIDENTIFIER         -->
<style id="82" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_USER1                    -->
<style id="83" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_USER2                    -->
<style id="84" fore-color-light="#B9CB89" back-color-light="#707070" bold="No" />   <!-- SCE_MYSQL_USER3                    -->
<style id="85" fore-color-light="#FFBB80" back-color-light="#909090" bold="No" />   <!-- SCE_MYSQL_HIDDENCOMMAND            -->
<style id="86" fore-color-light="#AAAAAA" back-color-light="#909090" bold="No" />   <!-- SCE_MYSQL_PLACEHOLDER              -->

You can also change the scheme to Windows 7 under Edit -> Preferences -> Fonts & Colors in Workbench to make some extra elements a bit darker than default (for me at least).