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

Bold and italic text formatting in themes #1893

Merged
merged 2 commits into from
Sep 28, 2024

Conversation

austincondiff
Copy link
Collaborator

@austincondiff austincondiff commented Sep 27, 2024

Description

We are adding bold and italic text formatting to existing bundled themes and providing the ability for user to configure custom themes to use bold and italic for each token.

Note

This only adds this to theme settings which persists to the theme file when edited. We are not currently using this in our text view and this will need to be implemented in CodeEditTextView / CodeEditSourceEditor in order to see these settings reflected in the source editor.

Related Issues

n/a

Checklist

  • I read and understood the contributing guide as well as the code of conduct
  • The issues this PR addresses are related to each other
  • My changes generate no new warnings
  • My code builds and runs on my machine
  • My changes are all related to the related issue above
  • I documented my code

Screenshots

Screen.Recording.2024-09-26.at.11.27.00.PM.mov

@austincondiff austincondiff changed the title Add bold and italic text formatting to themes Bold and italic text formatting in themes Sep 27, 2024
@thecoolwinter
Copy link
Collaborator

Thinking about future directions with themes, would it be better to use a weight: String? property rather than a boolean for bold? That'd allow for semibold, heavy, etc. when we eventually add those.

@austincondiff
Copy link
Collaborator Author

austincondiff commented Sep 27, 2024

@thecoolwinter I don't think so. bold should make text bolder regardless of what weight is chosen as default. I am not sure off hand what this looks like in AppKit, but I know in SwiftUI there is a .bold() modifier that makes text bolder than it is regardless of the original weight (used here). This approach should be used when we implement this in CETV.

Looking at themes in Xcode, from what I've seen there is only ever bold and not bold, nothing in between.

Copy link
Member

@activcoding activcoding left a comment

Choose a reason for hiding this comment

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

Love the design!
Maybe we could use an array to store font changes for each word type, like:
"modifiers": ["italic", "bold", ...]
What do you think?

@austincondiff
Copy link
Collaborator Author

@activcoding because there are only two, I'd prefer to keep the API simple. If there were more boolean settings I'd consider that though.

@austincondiff austincondiff merged commit bda9940 into CodeEditApp:main Sep 28, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

3 participants