Code Monkey home page Code Monkey logo

Comments (5)

zlee-personal avatar zlee-personal commented on May 30, 2024

Just added hex color support.

from racket-rash.

willghatch avatar willghatch commented on May 30, 2024

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 in rash/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.

zlee-personal avatar zlee-personal commented on May 30, 2024

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.

zlee-personal avatar zlee-personal commented on May 30, 2024

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.

zlee-personal avatar zlee-personal commented on May 30, 2024

I'll close this now that the pr is submitted.

from racket-rash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.