Textarea Fun


I didn't want to pull in a big dependency like codemirror or ace editor to get fancy textareas. All I really wanted was a textarea that could do line numbers and have rows alternating between gray and white.

I'm happy to say that it is quite doable with some javascript and css styling!

This link was the big one that showed me it was possible to do the line numbers. I basically stole the logic of it and re-wrote it in svelte with reactive variables. This went pretty well.

I used this link to do the colors and this worked with some fudging. Unfortunately the background-attachment property doesn't seem to work in firefox but does in chrome. I can live with that. I use firefox as my daily driver but I don't think its worth fixing for now.

I'm really happy that I could get so much out of the textarea. I have played around with textareas before and used codemirror and ace editor elsewhere but for something dead simple this is pretty good.