wttr.in icon indicating copy to clipboard operation
wttr.in copied to clipboard

Dark background color

Open niksy opened this issue 8 years ago • 19 comments

Any chance of explicitly setting background color of output to dark background color? Visuals can be unreadable on light terminal themes.

screen shot 2016-02-20 at 12 38 17

niksy avatar Feb 20 '16 11:02 niksy

One tip, in order to change colors you could alias the wttr.in command on your .bashrc or .zshrc like the following:

alias weather='curl wttr.in/YOUR_CITY | sed -e "s:226m:202m:g"'

where 226m is the yellow color code on 256 colors terminals which is changed with a more readable orange (202m).

the complete list of colors could be reached here

update: a more comprehensive solution which I'm currently still using is:

_weather() {
    tmpfile=$(mktemp)
    curl -s wttr.in/$1 > $tmpfile
    cat $tmpfile | sed -e 's:226m:202m:g'
    rm $tmpfile
}
alias weather='_weather'

and I use this:

$ weather CITY

alex179ohm avatar Mar 19 '16 16:03 alex179ohm

You can reduce it to this:

_weather() { tmpfile=$(mktemp) curl -s wttr.in/$1 | sed -e 's:226m:202m:g' } alias weather='_weather

m0veax avatar Apr 18 '16 13:04 m0veax

@m0veax No, not really! What you did is what the first alias from @alex179ohm already does — pipe curl's output to sed. But, in addition, each time _weather is called you also create a wasteful temporary file (which is not used in your script and even not deleted afterwards).

yckart avatar Dec 09 '16 21:12 yckart

I also use a light terminal theme so I created a shell script to solve this issue.

weather.sh:

#!/bin/bash

# default location
LOC="${1:-ADD_YOUR_DEFAULT_LOCATION_HERE}"

# force dark background color
esc=$'\e'
bg="$esc[48;5;232m"
eol="$esc[K"

echo -e "$bg$eol"
curl -s "http://wttr.in/$LOC" | sed "s/^/$bg$eol  /;s/\[0m/\[0m$bg/g"
echo -e "$bg$eol"
screen shot 2017-01-17 at 4 05 25 pm

lexicalunit avatar Jan 17 '17 22:01 lexicalunit

The ANSI escape sequences to set a dark background could be simply sent along with the rest of the text, just like the rest of the color escapes.

book avatar Jul 05 '17 07:07 book

@book The issue not about background color per se, the point is to preare a new color scheme, that will good work with the new background

chubin avatar Jul 05 '17 09:07 chubin

In case anybody simply wants to remove color entirely, I do that with sed 's/\x1B[0-9\[;]\+m//g'

C4K3 avatar Aug 24 '17 19:08 C4K3

@C4K3 Just use ?T wttr.in/?T

it should work. Does it work for you?

chubin avatar Aug 24 '17 20:08 chubin

@chubin It does, awesome, I didn't know about that option.

C4K3 avatar Aug 24 '17 20:08 C4K3

@chubin Hi,

Sorry to ping on this, but could you make min temperature blue color just a little bit brighter, please? It's so cold here, I can barely distinguish the digits at the low end.

Konsole wttr.in

I'm using Konsole with slightly customized Arc Dark theme, its background color is solid #383c4a.

ratijas avatar Dec 21 '20 02:12 ratijas

I've changed it to violet. I think it is better so. You know, if it is -56⁰C outside, I think blue is not blue enough for that, it should be something special

Selection_083

chubin avatar Jan 01 '21 17:01 chubin

I made this utility a while ago primarily to deal with that problem. https://github.com/Layerex/term-invert-colors screen

Layerex avatar May 20 '21 16:05 Layerex

@Layerex It is a cool tool. Maybe it we should integrate it on the server side

chubin avatar Oct 31 '21 14:10 chubin

@chubin would be cool. But, I guess, fine-tuning original colorscheme without full inversion would be much better. For example, making sun orange or red and darkening other colors would fix the problem of readability without significantly altering colors.

Layerex avatar Nov 17 '21 19:11 Layerex

@Layerex I agree. I believe we should just create color schemes, and make it possible for the uses to add their own color schemes + select the current color scheme

chubin avatar Mar 27 '22 13:03 chubin

Why not use a proxy to invert the colors?

hello-smile6 avatar Mar 27 '22 19:03 hello-smile6

What proxy do you mean?

It would be really a good feature, to be able to specify the color scheme on the server side, so that anybody could just use it

chubin avatar Mar 27 '22 19:03 chubin

What proxy do you mean?

One that doesn't exist yet.

hello-smile6 avatar Mar 27 '22 19:03 hello-smile6

@chubin https://ansi-invert-proxy.9pfs.repl.co/https:/wttr.in/ I made a proxy that uses @Layerex 's library to invert ANSI escape sequences for requests. It's currently slow, but I'll try to make it more reliable (and maybe add caching).

hello-smile6 avatar Mar 27 '22 20:03 hello-smile6