v6: Align GraphQL syntax colors and color type names by category#4403
Merged
Conversation
…uilder Doc explorer colors type names orange, field names green, and argument names purple. History and query builder didn't follow the same scheme: history rendered operation labels in the default foreground, and query builder colored composite return types and type conditions blue while leaving argument names uncolored. Both now reuse the same accent tokens doc explorer uses, documented in `tokens.css`.
🦋 Changeset detectedLatest commit: bc40d58 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR does two related things for GraphQL identifier coloring across the first-party plugins.
1. Align colors across plugins. Type names, field names, and argument names now use the same colors across the doc explorer, history, and query builder. Doc explorer was already internally consistent (orange types, green fields, purple arguments), so it's the reference the other two now follow. History's saved query labels (previously plain foreground text) are now the same green as field names. Query builder previously colored composite return types and type-condition names blue and left argument names uncolored; both now match doc explorer.
2. Color type names by category. Instead of every type name being orange, type-name references are colored by GraphQL kind, so a field list is no longer a monotonous wall of orange:
This applies in the schema-aware plugins (doc explorer and query builder). The Monaco query editor is unchanged — it isn't schema-aware, so type names in query text stay orange.
Public API
The scheme is exposed so third-party plugins can conform to it and retheme it:
--type-composite,--type-scalar,--type-enum,--type-input— are the supported retheming surface (documented intokens.css).typeCategory(type)is exported from@graphiql/react; it buckets any GraphQL type into'scalar' | 'enum' | 'input' | 'composite', unwrapping list/non-null wrappers.Class names, internal selectors, and the
data-type-kindattribute remain private. Light-theme--type-inputuses a darker gold than the dark theme so it clears WCAG AA as text (~5–6.5:1 against the doc-explorer surfaces).Test plan
String/Int/Boolean/ID/custom scalars) are blue, enum types green, object/interface/union types orange, and input object types gold.... on TypeNamelabels are orange.Refs: #4219