The OBP OIDC Provider's UI has been refactored to use external CSS files instead of inline styles, eliminating code duplication and improving maintainability.
Location: src/main/resources/static/css/
- Purpose: Core styles shared across all pages
- Contains:
- Reset and base styles
- Typography (h1, h2, h3, paragraphs)
- Container layouts
- Links and navigation
- Code elements
- Badges and indicators
- Info cards and alert boxes
- Tables and lists
- Buttons
- Stats cards and grids
- Responsive design breakpoints
- Utility classes
- Purpose: Styles specific to form pages (login, authentication)
- Contains:
- Login container styles
- Form elements (inputs, selects, labels)
- Form buttons
- Error and info boxes
- Hint text
- Form layout helpers (rows, grids)
- Responsive form design
File: src/main/scala/com/tesobe/oidc/endpoints/StaticFilesEndpoint.scala
- Serves CSS files from
src/main/resources/static/css/ - Route:
/static/css/{filename}.css - Handles file loading from classpath resources
- Returns appropriate content types
- Error handling for missing files
File: src/main/scala/com/tesobe/oidc/server/OidcServer.scala
- Initialized
StaticFilesEndpointin server startup - Added route handler for static files (always available)
- Placed before other routes for optimal performance
-
Root page (
/)- Removed ~100 lines of inline CSS
- Added external CSS link
- Uses modern mode indicators
-
Health check (
/health)- Removed ~80 lines of inline CSS
- Simplified structure with utility classes
-
Login form (
/obp-oidc/auth)- Removed ~130 lines of inline CSS
- Links to both
main.cssandforms.css - Added
form-pagebody class
-
Test login (
/obp-oidc/test-login)- Removed ~120 lines of inline CSS
- Links to both CSS files
- Uses
login-container-largeclass
-
Clients page (
/clients)- Removed ~60 lines of inline CSS
- Kept only page-specific styles (client-specific classes)
- Uses alert components
-
Stats page (
/stats)- Removed ~150 lines of inline CSS
- Kept only gradient header styles
- Simplified with shared components
-
Info page (
/info)- Already had modern styling
- No changes needed
-
Error pages
- Updated to use external CSS
- Uses alert components
- Reduced ~640+ lines of duplicate CSS code
- Single source of truth for styling
- Consistent design across all pages
- Change styles in one place
- Easy to update color schemes, fonts, spacing
- Clear separation of concerns
- CSS files are cacheable by browsers
- Reduced HTML payload size
- Faster page loads after first visit
- All colors and design tokens in one place
- Can easily create alternative themes
- Consistent spacing and sizing
- Centralized media queries
- Consistent mobile experience
- Easy to adjust breakpoints
Primary: #26a69a (teal)
Primary Dark: #1f8a7e
Success: #10b981
Error: #ef4444
Warning: #f59e0b
Info: #3b82f6
Text: #2c3e50
Subtle: #666
Background: #f8f9fa
Gradient Dark: #1a2a2a
Gradient Teal: #68b8a8Login and authentication pages feature the OBP Portal-style teal/green conic gradient:
background: conic-gradient(
from 180deg at 50% 50%,
#1a2a2a 0deg,
#68b8a8 120deg,
#1a2a2a 240deg,
#68b8a8 360deg
);
backdrop-filter: blur(40px);This creates a dynamic, professional background that matches the OBP Portal design language.
.container- Standard page container (max-width: 1200px).container-small- Narrow container (max-width: 600px).login-container- Form container (max-width: 450px).login-container-large- Large form container (max-width: 520px)
.alert- Base alert box.alert-info- Information alert (blue).alert-success- Success alert (green).alert-warning- Warning alert (orange).alert-error- Error alert (red)
.badge- Base badge.badge-primary- Primary badge (teal).badge-success- Success badge (green).badge-warning- Warning badge (orange)
.mode-indicator- Base mode indicator.mode-development- Development mode (orange).mode-production- Production mode (green)
.stats-grid- Grid layout for stats.stat-card- Individual stat card.stat-card.success- Success variant.stat-card.error- Error variant.stat-card.info- Info variant
.info-card- Information card with left border.info-grid- Grid layout for info cards
.text-center- Center text.mt-20- Margin top 20px.mb-20- Margin bottom 20px.p-20- Padding 20px
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/static/css/main.css" />
</head>
<body>
<div class="container">
<h1>Page Heading</h1>
<p class="subtitle">Page subtitle</p>
<!-- Content here -->
</div>
</body>
</html><!DOCTYPE html>
<html>
<head>
<title>Form Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/static/css/main.css" />
<link rel="stylesheet" href="/static/css/forms.css" />
</head>
<body class="form-page">
<div class="login-container">
<h2>Form Title</h2>
<p class="subtitle">Form subtitle</p>
<form>
<!-- Form fields here -->
</form>
</div>
</body>
</html><div class="alert alert-warning">
<strong>Note:</strong> This is a warning message.
</div><div class="stats-grid">
<div class="stat-card success">
<h2 class="stat-number">150</h2>
<p class="stat-label">Successful Logins</p>
<p class="stat-description">Users authenticated successfully</p>
</div>
<!-- More stat cards -->
</div>- Always link to
/static/css/main.css - For forms, also link to
/static/css/forms.css - Use existing component classes instead of inline styles
- Only add page-specific styles in
<style>tags if truly unique
Before:
<style>
.my-box {
background: #f8f9fa;
padding: 20px;
border-radius: 6px;
}
</style>After:
<!-- Just use existing .info-card class -->
<div class="info-card">
<!-- Content -->
</div>- CSS Variables - Use CSS custom properties for easier theming
- Dark Mode - Add dark theme support
- Animation Library - Shared animations for transitions
- Icon System - Consistent icon styling
- Print Styles - Optimize for printing
- Additional Themes - Alternative color schemes
When adding new styles:
- Check if similar style exists in
main.cssorforms.css - Reuse existing components when possible
- If creating new component, add it to appropriate CSS file
- Document new classes in this file
- Use consistent naming conventions (BEM or similar)
To verify CSS is working:
-
Start the server
mvn exec:java -Dexec.mainClass="com.tesobe.oidc.server.OidcServer" -
Test static file serving
curl http://localhost:8080/static/css/main.css curl http://localhost:8080/static/css/forms.css
-
Test pages render correctly
- Visit each page in a browser
- Check browser console for CSS loading errors
- Verify responsive design at different screen sizes
-
Test caching
- Refresh pages multiple times
- Check network tab for cached CSS files (304 responses)
The CSS uses modern but well-supported features:
- Flexbox
- CSS Grid
- CSS Custom Properties (if added)
- Modern color functions
- Viewport units
Supported Browsers:
- Chrome/Edge (latest 2 versions)
- Firefox (latest 2 versions)
- Safari (latest 2 versions)
- Mobile browsers (iOS Safari, Chrome Mobile)
- Review and remove unused CSS classes
- Optimize file size if it grows too large
- Update documentation when adding new components
- Test responsive design on new components
- Keep color palette consistent
main.css: Currently ~8KB uncompressedforms.css: Currently ~4KB uncompressed- Total: ~12KB (minimal impact on performance)
The login pages use a conic gradient inspired by the OBP Portal design:
- Creates a dynamic, rotating teal/green color effect
- Dark teal (#1a2a2a) provides contrast
- Bright teal (#68b8a8) adds visual interest
- Blur effect (40px backdrop-filter) softens the gradient
- Login container uses semi-transparent white (95% opacity) to stand out
The login container uses modern glassmorphism styling:
- Semi-transparent background:
rgba(255, 255, 255, 0.95) - Backdrop blur:
blur(10px) - Subtle border:
1px solid rgba(255, 255, 255, 0.2) - Enhanced shadow:
0 8px 32px rgba(0, 0, 0, 0.3)
This creates a "frosted glass" effect that's both modern and professional.
src/main/resources/static/css/main.css- Main stylesheetsrc/main/resources/static/css/forms.css- Form stylesheet (includes gradient background)src/main/scala/com/tesobe/oidc/endpoints/StaticFilesEndpoint.scala- Static file serversrc/main/scala/com/tesobe/oidc/server/OidcServer.scala- Server integration
This refactoring significantly improves the maintainability and consistency of the OBP OIDC Provider's UI. By centralizing styles into shared CSS files, we've reduced duplication, improved performance, and made future updates much easier.