Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add colors to text with control characters (like Commodore 64) #1227

Closed
SDMelipone opened this issue Oct 31, 2020 · 2 comments
Closed
Assignees

Comments

@SDMelipone
Copy link

On Commodore 64, you can enter colors as characters. This would be convenient for color changes within strings, especially when printing lots of text to screen. Here's an example GIF.
recording
In this example, Ctrl+number creates the characters before the 4, 5, 5 and sets a specific color.

@joshgoebel
Copy link
Collaborator

It'd also be pretty easy to do this with a small utility function I would think.

@nesbox nesbox self-assigned this Jul 12, 2021
@nesbox
Copy link
Owner

nesbox commented Jul 12, 2021

Agreed with @joshgoebel it can be easily done with small utility function.
For example:

function printc(str,x,y)
	local c=0 i=1 s=0
	while i<=#str do
		s=str:sub(i,i)i=i+1
		if s=='#'then c=tonumber(str:sub(i,i),16)i=i+1
		else print(s,x,y,c)x=x+6 end
	end
end

cls()
printc('#2H#3E#4L#5L#6O #7W#8O#9R#AL#BD#C!',10,10)
function TIC()end

image

@nesbox nesbox closed this as completed Jul 12, 2021
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

No branches or pull requests

3 participants