peterbrittain / asciimatics

A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Apache License 2.0
3.63k stars 237 forks source link

Highlighting support #21

Open peterbrittain opened 8 years ago

peterbrittain commented 8 years ago

I've just found out about https://github.com/chjj/blessed. This is a node.js library that aims to provide a similar high-level API to terminals as asciimatics. It has some neat extra features that it would be good to add.

The most obvious is the background colour highlighting that it puts on the main page demo. This provides a mechanism for painting the background with a new solid colour or a 50% linear combination (of the RGB colour tuples) of the existing BG colour and the highlight colour.

peterbrittain commented 8 years ago

Added basic highlight() method to Screen. Still need to add blending support, though. Looks like I should go for a weighted approach - see http://stackoverflow.com/questions/1847092/given-an-rgb-value-what-would-be-the-best-way-to-find-the-closest-match-in-the-d

peterbrittain commented 8 years ago

The nature of this highlighting is that to be fully effective, I need to resolve the full Screen refresh tracked in https://github.com/peterbrittain/asciimatics/issues/24. In the meantime, it is possible to force redrawing of the Screen by explicitly clearing it for any effects/widgets that use this feature, but this is sub-optimal to say the least.