Skip to content

Conversation

@teramako
Copy link
Owner

@teramako teramako commented May 8, 2025

Blend semi-colors with the terminal background color to make it more realistic

Before:

Image

Aflter:

image

@teramako teramako linked an issue May 8, 2025 that may be closed by this pull request
@teramako teramako marked this pull request as draft May 8, 2025 16:04
Copy link
Owner Author

@teramako teramako left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fix

Comment on lines 127 to 157
public static ReadOnlySpan<char> GetCtrlSeqResponse(string ctrlSeq)
public static ReadOnlySpan<char> GetCtrlSeqResponse(string ctrlSeq, char? endChar = null)
{
char end = ctrlSeq[^1];
char end = endChar ?? ctrlSeq[^1];
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow for general use, it should be possible to specify more than one end-of-reading character.

Comment on lines 131 to 133
// ^[]11;rgb:2828/2c2c/3434^[\
DebugPrint("GetTerminalBackgroundColor: ^[]11;?\\G => ", ConsoleColor.DarkGray);
var response = GetCtrlSeqResponse($"]11;?{(char)0x07}", '\\');
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note:
Windows Terminal response to OSC 11 ; ? BEL is strange.
The response seems to be OSC 11 ; rgb:RRRR/GGGG/BBBB \, when it really should be OSC 11 ; rgb:RRRR/GGGG/BBBB BEL (the tailing charactor should be BEL)

Right now, it conforms to the Windows Terminal specification, but it should be more generic.
Also, there should probably be a note in the comments.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah,, Windows Terminal response may be in the form OSC Ps ; Pt ST .
So it seems to be the correct behavior.

@Nutzzz
Copy link
Contributor

Nutzzz commented May 9, 2025

Tests were fixed in #21 .

@teramako
Copy link
Owner Author

teramako commented May 9, 2025

Test says:

System.AggregateException: One or more errors occurred. (Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.) ---> System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.

Console.ReadKey() does not appear to be available in the test workflow.
I would like to set Sixel.BackgroundColor = Color.White before the test is run.

teramako added 2 commits May 9, 2025 14:03
Enable to specify multiple characters to end the reading of standard input.
@teramako teramako marked this pull request as ready for review May 9, 2025 14:13
…ency

Replace to `Sixel.BackgroundColor` when the color table's color is gif's background color
@teramako teramako merged commit 1d1f549 into main May 9, 2025
1 check passed
@teramako teramako deleted the blend_terminal_bg branch May 11, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Alpha Blending for Transparent Images in Sixel encoding

3 participants