Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@chshersh
Copy link
Collaborator

@chshersh chshersh commented Feb 1, 2025

Closes #4

Implemented utilities for composable styles as per the discussed design in

I verified in utop that it works!

image

Let me know if you want any adjustments!

Copy link
Owner

@qexat qexat left a comment

Choose a reason for hiding this comment

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

Thank you for the PR!

Personally I would move the last inner function to be a method of Option in Util. Let me know your thoughts!

@qexat qexat linked an issue Feb 1, 2025 that may be closed by this pull request
@chshersh
Copy link
Collaborator Author

chshersh commented Feb 1, 2025

Thank you for the PR!

Personally I would move the last inner function to be a method of Option in Util. Let me know your thoughts!

You're welcome! It's a pleasure to contribute to this library 🥰

As for Option module in Util, I don't mind! However, when I tried to do that, I encountered naming conflicts.

Should I rename it to Optional or should I include the entire Option from the standard library?

Otherwise, it conflicts with the standard Option because of open Util in Color.

❯ dune build
File "lib/Color.ml", line 165, characters 2-12:
165 |   Option.map (fun (value : Int8.t) -> `Advanced value) (Int8.of_int value)
        ^^^^^^^^^^
Error: Unbound value Option.map

@qexat
Copy link
Owner

qexat commented Feb 1, 2025

Should I rename it to Optional or should I include the entire Option from the standard library?

Usually I use Util as a way to extend the stdlib, so the pattern is:

module Module = struct
  include Module
  
  ...
end

But if you think this is overkill for this function I'm fine with keeping it as an inner function!

@chshersh
Copy link
Collaborator Author

chshersh commented Feb 2, 2025

@qexat That's totally fine, I do that as well sometimes 😌

Just pushed the commit with the update!

Copy link
Owner

@qexat qexat left a comment

Choose a reason for hiding this comment

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

Good job, thank you a lot!

@qexat qexat merged commit cbd2476 into qexat:experimental/token-term Feb 2, 2025
@chshersh chshersh deleted the chshersh/compose branch February 2, 2025 14:36
qexat added a commit that referenced this pull request Feb 3, 2025
# 0.2.0

## Features

- Add color functions `luminance` and `best_for_contrast`. (by @chshersh in #5)
- Add styling functions `fg`, `bg`, `bold`, `dim`, `italic`, `underlined`. (by @chshersh in #6)
- Add styling composition with `&`. (by @chshersh in #6)
- Add function `make_rgb_hex` to parse hexadecimal codes into RGB colors. (by @chshersh in #7)

## Breaking Changes

- `Color.t` and `Color.Ground.t` are now polymorphic variants. (by @chshersh in #5)

## Removed

- `Util.parenthesize_if` which is deemed unuseful and is kind of a duplicate of `Tree.parenthesize_if` in `Formatting`.
qexat added a commit to qexat/opam-repository that referenced this pull request Feb 3, 2025
CHANGES:

## Features

- Add color functions `luminance` and `best_for_contrast`. (by @chshersh in qexat/ansifmt#5)
- Add styling functions `fg`, `bg`, `bold`, `dim`, `italic`, `underlined`. (by @chshersh in qexat/ansifmt#6)
- Add styling composition with `&`. (by @chshersh in qexat/ansifmt#6)
- Add function `make_rgb_hex` to parse hexadecimal codes into RGB colors. (by @chshersh in qexat/ansifmt#7)

## Breaking Changes

- `Color.t` and `Color.Ground.t` are now polymorphic variants. (by @chshersh in qexat/ansifmt#5)

## Removed

- `Util.parenthesize_if` which is deemed unuseful and is kind of a duplicate of `Tree.parenthesize_if` in `Formatting`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Composable styles

2 participants