FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
Gj64

Gj64

pback

Public
Like
pback
Home
Code
5
backend
1
frontend
4
shared
5
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
shared
/
README.md
Code
/
shared
/
README.md
Search
6/8/2025
Viewing readonly version of main branch: v20
View latest version
README.md

Shared Utilities

This folder contains utility functions and types that are shared between the frontend and backend components of Text Studio.

Files

utils.ts

Common utility functions for:

  • Color manipulation and conversion
  • Contrast ratio calculations
  • File handling and validation
  • Gradient generation
  • Performance optimizations (debounce)
  • Type-safe deep cloning

Usage

import { hexToRgb, getContrastRatio, debounce } from '/shared/utils.ts'; // Convert hex to RGB const rgb = hexToRgb('#007AFF'); // Check color contrast const ratio = getContrastRatio('#FFFFFF', '#000000'); // Debounce function calls const debouncedUpdate = debounce(updateFunction, 300);

Design Principles

  • Universal Compatibility: All functions work in both browser and server environments
  • Type Safety: Full TypeScript support with proper type definitions
  • Performance: Optimized for real-time canvas operations
  • Accessibility: Includes contrast checking for WCAG compliance
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareersBrandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.