inehemiasm/AiAssistant / skills/display-glasses-with-jetpack-compose-glimmer
display-glasses-with-jetpack-compose-glimmer
VerifiedProvides guidelines for developing projected Android XR apps for display glasses using the Jetpack Compose Glimmer UI toolkit. This skill covers foundational Glimmer design principles, workflows for implementing Jetpack Compose Glimmer, and interaction models for the glasses form factor. Use this skill to build an Android XR Augmented Experience app with Jetpack Compose Glimmer that adheres to the Glimmer design system for optimized glasses styling.
references/android/develop/xr/jetpack-xr-sdk/jetpack-compose-glimmer/text.md
View on GitHub<br />
Applicable XR devices This guidance helps you build experiences for these types of XR devices. [Learn about XR device types →](https://developer.android.com/develop/xr/devices)  Display Glasses [](https://developer.android.com/develop/xr/devices#audio-display) [Learn about XR device types →](https://developer.android.com/develop/xr/devices)
<br />
In Jetpack Compose Glimmer, the [`Text`](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/Text.composable) component lets you set various text
properties like color, font size, font style, font weight, font family, letter
spacing, and text alignment.
Jetpack Compose Glimmer Text is unique because it intelligently manages color
matching. For example, if no color override is specified, the text defaults to
the content color provided by the nearest surface that it's sitting on.
## Example: Create a text heading in a box
@Composable
fun TextSample() {
Text(
text = "This is a sample heading",
style = GlimmerTheme.typography.titleLarge )
}
### Key points about the code
- Because no color is specified, this text looks at the nearest surface to pick the best readable color (usually white).
## Sizing
Typography scale in Jetpack Compose Glimmer is significantly larger than
standard mobile Material Design. Styles like `TitleLarge` and `BodyLarge` are
both `30.sp`, and the Caption is `18.sp`:
| Style | Size (sp) | Weight | Line Height |
|---|---|---|---|
| titleLarge | 30 | 750 | 36.sp |
| titleMedium | 24 | 750 | 28.sp |
| titleSmall | 20 | 750 | 28.sp |
| bodyLarge | 30 | 520 | 36.sp |
| bodyMedium | 24 | 520 | 36.sp |
| bodySmall | 20 | 520 | 28.sp |
| caption | 18 | 650 | 24.sp |
## Use Google Sans Flex
[Google Sans Flex](https://fonts.google.com/specimen/Google+Sans+Flex?query=google+sans&preview.script=Latn) is a variable font specifically chosen for AI
glasses that is provided as part of the Jetpack Compose Glimmer. The font's
rounded corners and adjustable axes allow for ideal optical sizing, ensuring
that text remains glanceable and legible. If possible, to improve consistency
for users between your app and the system, use Google Sans Flex for all text
displayed on display glasses.
To use Google Sans Flex, [add the `glimmer-google-fonts` library to your app's
dependencies](https://developer.android.com/develop/xr/jetpack-xr-sdk/set-up-sdk#augmented), then apply the font globally to the `GlimmerTheme`:
```kotlin
@Composable
fun GoogleSansFlexTypographySample() {
val typography = createGoogleSansFlexTypography()
GlimmerTheme(typography = typography) {
Text("Hello World", style = GlimmerTheme.typography.titleLarge)
}
}
```
<br />Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |