diff options
author | 2012-06-20 13:59:12 -0400 | |
---|---|---|
committer | 2012-06-20 13:59:12 -0400 | |
commit | ce0ba5bc4849a9d6b77d18271c75bba112e7a4be (patch) | |
tree | 2f641f1ce2d13bdbe07980b7221201fbbdec7e0e | |
parent | 52690406faf59fd0a15652cb7997567228b9330a (diff) | |
download | textadept-ce0ba5bc4849a9d6b77d18271c75bba112e7a4be.tar.gz textadept-ce0ba5bc4849a9d6b77d18271c75bba112e7a4be.zip |
Use `~/.textadept/theme_term` or default 'term' theme for ncurses; core/gui.lua
-rw-r--r-- | core/gui.lua | 13 | ||||
-rw-r--r-- | doc/08_Themes.md | 7 |
2 files changed, 12 insertions, 8 deletions
diff --git a/core/gui.lua b/core/gui.lua index 8eaa80ed..778f3539 100644 --- a/core/gui.lua +++ b/core/gui.lua @@ -7,7 +7,7 @@ local gui = gui -- @field title (string, Write-only) -- The title of the Textadept window. -- @field context_menu --- A GTK menu defining the editor's context menu. +-- A `gui.menu` defining the editor's context menu. -- @field clipboard_text (string, Read-only) -- The text on the clipboard. -- @field statusbar_text (string, Write-only) @@ -159,13 +159,15 @@ local THEME -- @name set_theme function gui.set_theme(name) if not name then - -- Read theme from ~/.textadept/theme, defaulting to 'light'. - local f = io.open(_USERHOME..'/theme', 'rb') + -- Read theme from ~/.textadept/theme or ~/.textadept/theme_term depending + -- on NCURSES platform, defaulting to 'light' or 'term' respectively. + local theme_file = not NCURSES and 'theme' or 'theme_term' + local f = io.open(_USERHOME..'/'..theme_file, 'rb') if f then name = f:read('*line'):match('[^\r\n]+') f:close() end - if not name or name == '' then name = 'light' end + if not name or name == '' then name = not NCURSES and 'light' or 'term' end end -- Get the path of the theme. @@ -225,7 +227,8 @@ function gui.select_theme() if not theme then return end gui.set_theme(theme) -- Write the theme to the user's theme file. - local f = io.open(_USERHOME..'/theme', 'wb') + local theme_file = not NCURSES and 'theme' or 'theme_term' + local f = io.open(_USERHOME..'/'..theme_file, 'wb') if not f then return end f:write(theme) f:close() diff --git a/doc/08_Themes.md b/doc/08_Themes.md index 4fc1aea3..64d721c5 100644 --- a/doc/08_Themes.md +++ b/doc/08_Themes.md @@ -1,9 +1,10 @@ # Themes Textadept's look and feel can be customized with themes. The themes that come -with Textadept are `light` and `dark`'. By default the `light` theme is used. To -change the theme, create a `~/.textadept/theme` file whose first line of text is -the name of the theme you would like to use. +with Textadept are `light`, `dark`, and `term`. By default the `light` theme is +used for GUI environments and `term` for terminal environments. To change the +theme, create a `~/.textadept/theme` and/or `~/.textadept/theme_term` whose +first lines of text are the names of the themes you would like to use.  |