Chalk: Is there anyway to detect if the terminal BG is light or dark?

Created on 11 Mar 2016  路  4Comments  路  Source: chalk/chalk

Hello everyone! i'm trying to make my first cli-app and added some chalk.js sweetness but i have a problem with the rendering on different terminal apps.
Is there a workaround to support all of them with different bg's?

Thanks :D

Left: iterm2 V3
right: osx terminal Version 2.6.1 (361.1)
screenshot 2016-03-11 09 03 46

Most helpful comment

I don't think there's a way to detect the terminal background color.

// @Qix-

All 4 comments

I don't think there's a way to detect the terminal background color.

// @Qix-

There's a kind of workaround by using the inverse method. It's not exactly what I wanted but it works on every terminal. :D I'll try to dig more, to see if there's a better way of doing this.
screenshot 2016-03-11 14 44 30

Nope, unfortunately nothing that is cross-platform. Terminals are generally a one-way means of interaction in terms of styling.

@sindresorhus @Qix- Thanks for the quick replies! :D
I'll stick to the inverse method until i find how to style it better.
Thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ORESoftware picture ORESoftware  路  6Comments

Offirmo picture Offirmo  路  4Comments

HillTravis picture HillTravis  路  8Comments

fearphage picture fearphage  路  7Comments

Elberet picture Elberet  路  4Comments