Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable terminal color theme #310

Closed
waruqi opened this Issue Dec 28, 2018 · 5 comments

Comments

Projects
None yet
1 participant
@waruqi
Copy link
Member

waruqi commented Dec 28, 2018

  • Custom theme styles
  • Add theme module and api
  • Some builtin theme styles
    • default style
    • plain style
    • dark style
    • emoji style

@waruqi waruqi added the new feature label Dec 28, 2018

@waruqi waruqi added this to the v2.2.4 milestone Dec 28, 2018

@waruqi

This comment has been minimized.

Copy link
Member Author

waruqi commented Jan 2, 2019

Modify global theme

$ xmake g --theme=dark

Clear and use the default theme

$ xmake g -c
@waruqi

This comment has been minimized.

Copy link
Member Author

waruqi commented Jan 3, 2019

The default theme

-- define theme
theme("default")

    -- the success status 
    set_text("success", "$ok")
    set_color("success", "green")

    -- the failure status 
    set_text("failure", "failed")
    set_color("failure", "red")

    -- the nothing status 
    set_text("nothing", "no")
    set_color("nothing", "red")

    -- the error info
    set_text("error", "error")
    set_color("error", "red")

    -- the warning info
    set_text("warning", "$warning")
    set_color("warning", "yellow")

    -- the building progress
    set_text("build.progress_format", "[%3d%%]")
    set_color("build.progress", "green")

    -- the building object file
    set_color("build.object", "")

    -- the building target file
    set_color("build.target", "magenta")
$ xmake 
checking for the architecture ... x86_64
checking for the Xcode directory ... /Applications/Xcode.app
checking for the SDK version of Xcode ... 10.14
checking for the libc_setlocale ... ok
checking for the posix_poll ... ok
checking for the posix_socket ... ok
checking for the posix_getpagesize ... ok
checking for the libc_kill ... ok
checking for the posix_pwritev ... no
@waruqi

This comment has been minimized.

Copy link
Member Author

waruqi commented Jan 3, 2019

The emoji theme

-- define theme
theme("emoji")

    -- the success status 
    set_text("success", "heavy_check_mark")
    set_color("success", "")

    -- the failure status 
    set_text("failure", "x")
    set_color("failure", "")

    -- the nothing status 
    set_text("nothing", "o")
    set_color("nothing", "")

    -- the error info
    set_text("error", "exclamation error")
    set_color("error", "red")

    -- the warning info
    set_text("warning", "warning $warning")
    set_color("warning", "yellow")

    -- the building progress
    set_text("build.progress_format", "[%3d%%]")
    set_color("build.progress", "green")

    -- the building object file
    set_color("build.object", "")

    -- the building target file
    set_color("build.target", "magenta")
$ xmake g --theme=emoji
$ xmake
checking for the libm_atan2 ... ✔
checking for the posix_execvp ... ✔
checking for the libc_wcsncat ... ✔
checking for the posix_fork ... ✔
checking for the posix_pwritev ... ⭕
checking for the posix_getifaddrs ... ✔
checking for the libc_strcat ... ✔
checking for the libm_pow ... ✔
@waruqi

This comment has been minimized.

Copy link
Member Author

waruqi commented Jan 3, 2019

Update dev version and try it

$ xmake update dev
@waruqi

This comment has been minimized.

Copy link
Member Author

waruqi commented Jan 3, 2019

Add user custom theme:

Add theme (mytheme) to ~/.xmake/themes/mytheme/xmake.lua

xmake.lua

theme("mytheme")
    -- set color and text

Use theme:

$ xmake g --theme=mytheme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.