How can I change my tmux color scheme based on the time of day?
Clash Royale CLAN TAG#URR8PPP
I just implemented a few lines into my .vimrc that changes the color scheme from SolarizedDark to SolarizedLight based on the time of day.
" Solarized light during the day, solarized dark during the night
let hour = strftime("%H")
if 6 <= hour && hour < 18
set background=light
else
set background=dark
endif
Is it possible to do this for tmux and OS X terminal as well?
terminal vim tmux
add a comment |
I just implemented a few lines into my .vimrc that changes the color scheme from SolarizedDark to SolarizedLight based on the time of day.
" Solarized light during the day, solarized dark during the night
let hour = strftime("%H")
if 6 <= hour && hour < 18
set background=light
else
set background=dark
endif
Is it possible to do this for tmux and OS X terminal as well?
terminal vim tmux
add a comment |
I just implemented a few lines into my .vimrc that changes the color scheme from SolarizedDark to SolarizedLight based on the time of day.
" Solarized light during the day, solarized dark during the night
let hour = strftime("%H")
if 6 <= hour && hour < 18
set background=light
else
set background=dark
endif
Is it possible to do this for tmux and OS X terminal as well?
terminal vim tmux
I just implemented a few lines into my .vimrc that changes the color scheme from SolarizedDark to SolarizedLight based on the time of day.
" Solarized light during the day, solarized dark during the night
let hour = strftime("%H")
if 6 <= hour && hour < 18
set background=light
else
set background=dark
endif
Is it possible to do this for tmux and OS X terminal as well?
terminal vim tmux
terminal vim tmux
asked Oct 26 '15 at 15:55


mpanharimpanhari
114
114
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Not readily at the level of tmux
or OSX Terminal (tmux
's scripting does not appear powerful enough), but if you happen to be using bash
, it has a feature called the prompt-command into which you can put scripts.
Here are some pointers (with examples):
- Bash Prompt HOWTO: 4.1. PROMPT_COMMAND
- What is the difference between PS1 and PROMPT_COMMAND
- ArchLinux: Color Bash Prompt
If you happen to be using zsh
, it seems that offers possibilities as well:
- Steve Losh: My Extravagant Zsh Prompt
- How to Customize Your Command Prompt
The key point in all of these is that some shells provide the ability to invoke general-purpose scripts each time the prompt is displayed.
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f238722%2fhow-can-i-change-my-tmux-color-scheme-based-on-the-time-of-day%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Not readily at the level of tmux
or OSX Terminal (tmux
's scripting does not appear powerful enough), but if you happen to be using bash
, it has a feature called the prompt-command into which you can put scripts.
Here are some pointers (with examples):
- Bash Prompt HOWTO: 4.1. PROMPT_COMMAND
- What is the difference between PS1 and PROMPT_COMMAND
- ArchLinux: Color Bash Prompt
If you happen to be using zsh
, it seems that offers possibilities as well:
- Steve Losh: My Extravagant Zsh Prompt
- How to Customize Your Command Prompt
The key point in all of these is that some shells provide the ability to invoke general-purpose scripts each time the prompt is displayed.
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
add a comment |
Not readily at the level of tmux
or OSX Terminal (tmux
's scripting does not appear powerful enough), but if you happen to be using bash
, it has a feature called the prompt-command into which you can put scripts.
Here are some pointers (with examples):
- Bash Prompt HOWTO: 4.1. PROMPT_COMMAND
- What is the difference between PS1 and PROMPT_COMMAND
- ArchLinux: Color Bash Prompt
If you happen to be using zsh
, it seems that offers possibilities as well:
- Steve Losh: My Extravagant Zsh Prompt
- How to Customize Your Command Prompt
The key point in all of these is that some shells provide the ability to invoke general-purpose scripts each time the prompt is displayed.
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
add a comment |
Not readily at the level of tmux
or OSX Terminal (tmux
's scripting does not appear powerful enough), but if you happen to be using bash
, it has a feature called the prompt-command into which you can put scripts.
Here are some pointers (with examples):
- Bash Prompt HOWTO: 4.1. PROMPT_COMMAND
- What is the difference between PS1 and PROMPT_COMMAND
- ArchLinux: Color Bash Prompt
If you happen to be using zsh
, it seems that offers possibilities as well:
- Steve Losh: My Extravagant Zsh Prompt
- How to Customize Your Command Prompt
The key point in all of these is that some shells provide the ability to invoke general-purpose scripts each time the prompt is displayed.
Not readily at the level of tmux
or OSX Terminal (tmux
's scripting does not appear powerful enough), but if you happen to be using bash
, it has a feature called the prompt-command into which you can put scripts.
Here are some pointers (with examples):
- Bash Prompt HOWTO: 4.1. PROMPT_COMMAND
- What is the difference between PS1 and PROMPT_COMMAND
- ArchLinux: Color Bash Prompt
If you happen to be using zsh
, it seems that offers possibilities as well:
- Steve Losh: My Extravagant Zsh Prompt
- How to Customize Your Command Prompt
The key point in all of these is that some shells provide the ability to invoke general-purpose scripts each time the prompt is displayed.
edited May 23 '17 at 12:40
Community♦
1
1
answered Oct 26 '15 at 22:21


Thomas DickeyThomas Dickey
53.4k5101174
53.4k5101174
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
add a comment |
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Something running as a background shell job can keep updating the color even if the prompt is not displayed, but in this way output from other programs have chances to mix up with the job.
– Arthur2e5
Oct 27 '15 at 0:49
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
Sure - but the choices in that case would be to apply the color scheme only to the prompt, or just live with other applications' notion of colors. Since you keep returning to the prompt, though, that's a place to keep resetting colors, to enforce it. Not 100% reliable as you note.
– Thomas Dickey
Oct 27 '15 at 0:52
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f238722%2fhow-can-i-change-my-tmux-color-scheme-based-on-the-time-of-day%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown