Comments (5)
Just added hex color support.
from racket-rash.
Looks good. Some comments:
- You should
(provide create-colored-string)
. - The require of
rashrc-git-stuff
is unnecessary. - It's good as it is, but it's often convenient to be able to nest styles within each other and have it come out right. Do you think it would make sense to have a function that will emit structs that contain style information and a list of strings or sub-styled-string structs, and then have a function that converts them all into a string styled properly by applying
create-colored-string
to each sub-element? Eg. it could look like(colored-string-struct->string (colored-string-struct "this is green" (colored-string-struct " this is red but still underlined " #:fg "red") "this is green again" #:fg "green" #:underlined? #t))
. But perhaps with better names. And I'm not sure whether it makes more sense to have the middle one be underlined or not. I would lean to yes, except when the inner one specifies otherwise explicitly. At any rate, I'm happy to include it in Rash with or without the enhancements -- maybe inrash/prompt-helpers/string-color.rkt
. Feel free to submit a PR. - In addition to numbers and strings, you might accept Racket's
color%
objects. At least as long as that doesn't pull in any dependencies on GUI stuff. But I don't really have strong feelings either way. - I notice that it has Windows line endings. This combined with your issue about readline not working on Windows leads me to believe you are perhaps primarily a Windows user? If so, have you found any other problems with Rash besides that? I've been meaning to add command-line options to, among other things, not use readline. As far as I know everything else works on Windows -- at least it did several months or a year ago when I tested it once. But any testing you do on windows would be helpful as well.
from racket-rash.
You should (provide create-colored-string).
The require of rashrc-git-stuff is unnecessary.
Yeah the function sort of evolved from me trying to create a powerline prompt and I forgot to clean it up.
It's good as it is, but it's often convenient to be able to nest styles within each other and have it come out right...
Yeah, structs seem like a good idea here as they can store the string and the style info. I would assume the struct->string
function takes care of the nested structs by storing the outer style, making the nested style (string-append outer inner)
so inner can override, then clearing all the style and re-applying the outer style for the rest of the struct. If inner structs didn't inherit style from the outer ones, the nesting ability wouldn't do much good. I guess the struct function could have a #:reset-before?
like the current function.
I can provide the current function and a struct one if you want, or just the struct one.
I'll check out color%
as well.
I notice that it has Windows line endings. This combined with your issue about readline not working on Windows leads me to believe you are perhaps primarily a Windows user? If so, have you found any other problems with Rash besides that?
Unfortunately, I do have windows installed, but mainly for compatibility. I mainly use arch, but when I'm on windows, I use the wsl to run rash, and I would probably recommend that to anyone interested in both command line interfaces and windows. I haven't been able to run rash on bare windows due to the readline issue, but I will try to find a windows version of readline so I can do that.
from racket-rash.
I don't think this could support opacity, right? Because color%
has an alpha value. I'm just gonna ignore it unless there's a special formula that can incorporate opacity into rgb. I know there is one if you know the background color, but that's part of the terminal, not the shell I believe. I would have to redesign how fg displays as well, because the fg could have an opacity in relation to the bg.
from racket-rash.
I'll close this now that the pr is submitted.
from racket-rash.
Related Issues (20)
- some packages are downloaded via HTTP ? HOT 7
- [Windows] libedit-3.dll issues HOT 9
- I've been waiting for something like this for a long time HOT 1
- Save history between sessions? HOT 1
- SIGPIPE issue
- Ctrl-C handling HOT 4
- testing maubot integration
- Relicensing Rash HOT 8
- Allow comment with # in repl HOT 1
- terminal title with current directory HOT 2
- Tab completion does not quote
- ls causes issues with history-delete HOT 18
- Can't exit shell on Mac OS X HOT 2
- Behavior of Control-c (C-c, ^C, SIGINT) when no process is active HOT 3
- How to build documentation? HOT 2
- contract violation on 8.2[cs]? HOT 6
- Resizing terminal emulator
- Rash in Jupyter (with iracket) HOT 5
- multi-line readline prompt with ansi-escapes HOT 3
- Get the exit code of the last command HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from racket-rash.