race604 / clock-tui

A clock app in terminal written in Rust, supports local clock, timer and stopwatch.
MIT License
84 stars 7 forks source link

7-segment display style #14

Closed wezm closed 2 years ago

wezm commented 2 years ago

Unicode 13 added these 7-segment display characters:

🯰 🯱 🯲 🯳 🯴 🯵 🯶 🯷 🯸 🯹 (Image in case they aren't appearing: Screenshot from 2022-08-16 13-38-36)

I was thinking about adding a --style/-S option to let you choose the letter style between the brick chars and 7-segment chars.

Before I work on this I was wondering if this was contribution you'd be interested in accepting?

race604 commented 2 years ago

Sounds very interesting, the 7-segment style looks beautiful. I will be very happy to accept the contribution.

BTW, I was thinking about support more styles but failed. Curious how you plan to implement it? Appreciate if you want to share more details before you start.

wezm commented 2 years ago

BTW, I was thinking about support more styles but failed. Curious how you plan to implement it? Appreciate if you want to share more details before you start.

I was thinking something along these lines but have not verified in detail if it will work:

race604 commented 2 years ago

The abstraction of Font looks great, love it.

In addition to this, my question is what the SevenSegment font looks like? Considering that the terminal are all text chars, we can think of each char as a pixel, it seems very difficult to render each segment of as long hexagon (highlighted on blue oval bellow):

image
wezm commented 2 years ago

Ahh I wasn't going to do anything special to render the seven-segment digits. I was thinking it would just output the digits as text (using the Unicode codepoints) like 🯱:🯲🯳 and zoom the font size of the terminal window to make them bigger.

race604 commented 2 years ago

I see, thanks for the explanation, but it seems that It's not what I thought. I want to share some thoughts about the design of this tool:

Based on these premises, I choose to use character bricks to compose big digitals, and I suppose the original 7-segment display characters is not case. How do you think about it?

wezm commented 2 years ago

Based on these premises, I choose to use character bricks to compose big digitals, and I suppose the original 7-segment display characters is not case. How do you think about it?

Thanks for sharing the design of the tool, that makes a lot of sense. With this in mind it seems I am perhaps trying to use the clock in a way it was not designed, so perhaps it is not right to add the seven-segement feature. I'm using the timer in large text but for the clock I just want a small clock in the corner of my screen. I might build this as a separate project.

race604 commented 2 years ago

Awesome, your use case sounds very interesting, looking forward to your project!

wezm commented 2 years ago

I built the clock, probably should add an option to set the colour (I added colour support) but it seems to work. https://github.com/wezm/7clock

race604 commented 2 years ago

Great, thanks for sharing! 7clock is beautiful and concise in implementation.