-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add code syntax theme to docs #405
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
@import "variables"; | ||
|
||
$light-scopes: ( | ||
"attribute-name": $orange3, | ||
"background": $white, | ||
"comment": $gray2, | ||
"constant": $turquoise2, | ||
"function": $blue2, | ||
"id": $gold2, | ||
"keyword": $violet3, | ||
"numeric": $rose2, | ||
"operator": $violet2, | ||
"pseudo-class": $rose2, | ||
"punctuation": $dark-gray3, | ||
"string": $lime1, | ||
"tag": $forest2, | ||
"text": $dark-gray1, | ||
"type": $gold2, | ||
"variable": $turquoise2, | ||
); | ||
|
||
$dark-scopes: ( | ||
"attribute-name": $orange4, | ||
"background": $dark-gray2, | ||
"comment": $gray2, | ||
"constant": $turquoise5, | ||
"function": $blue4, | ||
"id": $gold5, | ||
"keyword": $violet4, | ||
"numeric": $rose4, | ||
"operator": $violet5, | ||
"pseudo-class": $rose3, | ||
"punctuation": $light-gray5, | ||
"string": $lime4, | ||
"tag": $forest3, | ||
"text": $gray5, | ||
"type": $gold4, | ||
"variable": $turquoise3, | ||
); | ||
|
||
|
||
@mixin syntax($scopes) { | ||
background: map-get($scopes, "background"); | ||
color: map-get($scopes, "text"); | ||
|
||
@each $scope in ("punctuation" "comment" "string" "constant" "numeric" "variable" "keyword" "operator") { | ||
.#{$scope} { color: map-get($scopes, $scope); } | ||
} | ||
|
||
.storage { | ||
@extend .keyword; | ||
} | ||
|
||
.entity.name, | ||
.meta.name, | ||
.support.type { | ||
color: map-get($scopes, "type"); | ||
} | ||
|
||
.entity { | ||
@each $scope in ("attribute-name" "tag" "function" "pseudo-class") { | ||
&.#{$scope} { color: map-get($scopes, $scope); } | ||
} | ||
|
||
&.pseudo-element { | ||
@extend .tag; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be a lint error? we should be using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think we disabled that nonsense cuz we moved our placeholders to mixins. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see why that justifies disabling the rule? If we aren't using placeholders, then there should really be no reason to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you'll notice i didn't disable the rule here. it's always been like this. this seems like a valid use of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. searching for usages of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I know it hasn't been disabled inline, I'm just alarmed that this passed lint because I expected the rule to be enabled across the codebase. There's a good reason the lint rule is there. Basically every time it's been circumvented has been regretful. But this is in the docs site so I don't mind being lenient about it. Still should be accompanied with a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, now we have an objectively better solution that involves a whopping zero There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
} | ||
|
||
.support.type.scss, | ||
.punctuation.definition.css { | ||
color: inherit; | ||
} | ||
} | ||
|
||
// actually generate the two themes: | ||
|
||
.editor-colors { | ||
@include syntax($light-scopes); | ||
|
||
.pt-dark & { | ||
@include syntax($dark-scopes); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: calling this argument "scopes" is a little confusing; I would just call it "colors" or something