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

Make font weights more aligned with Xcode #245

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ extension TextViewController: ThemeAttributesProviding {
[
.font: font,
.foregroundColor: theme.colorFor(capture),
.kern: textView.kern
.kern: textView.kern,
.strokeWidth: theme.widthFor(capture),
]
}
}
12 changes: 12 additions & 0 deletions Sources/CodeEditSourceEditor/Theme/EditorTheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ public struct EditorTheme {
default: return text
}
}

/// Gets the `strokeWidth` for the specified capture name.
/// - Parameter capture: The capture name
/// - Returns: a float representing `strokeWidth`
func widthFor(_ capture: CaptureName?) -> Float {
switch capture {
case .include, .constructor, .keyword, .boolean, .variableBuiltin,
.keywordReturn, .keywordFunction, .repeat, .conditional, .tag, .type:
return -3.0
default: return 0.0
}
}
}

extension EditorTheme: Equatable {
Expand Down