Student starter code (30% baseline)
index.html
- Main HTML pagescript.js
- JavaScript logicstyles.css
- Styling and layoutpackage.json
- Dependenciessetup.sh
- Setup scriptREADME.md
- Instructions (below)💡 Download the ZIP, extract it, and follow the instructions below to get started!
W3 Server-Side Development & Authentication - Lesson 11
Build an interactive color manipulation application using Svelte's logic, conditional rendering, and list iteration features. This project challenges you to create a dynamic UI that responds to user interactions and manages complex color data.
By completing this project, you will:
{#if}
, {:else}
){#each}
blocksThis template is from: Web-3-Project-3-Play-With-Colours
✅ Basic Svelte project structure
✅ Development environment configuration
✅ Empty PlayColors.svelte
component
✅ Minimal routing setup in src/routes/
Color Picker Interface
Color List Management
Color Information Display
User Interactions
Navigate to this template folder:
cd "Paid Courses/W3 Server-Side Development & Authentication/Templates/project-03-colours"
Install dependencies:
npm install
Start development server:
npm run dev
Open in browser:
Visit http://localhost:5173
project-03-colours/
├── src/
│ ├── routes/
│ │ └── index.svelte # Main page (TODO: implement UI)
│ └── PlayColors.svelte # Color component (TODO: build logic)
├── package.json # Dependencies
└── svelte.config.js # Svelte configuration
Before implementing, research and answer:
Conditional Rendering: How do you show different UI based on conditions in Svelte?
{#if}
vs CSS classes?List Iteration: How do you render arrays in Svelte?
{#each}
blocks?Color Conversion: How do you convert between color formats?
Event Handling: How do you handle forms and clicks in Svelte?
<!-- TODO: Implement color input in index.svelte or PlayColors.svelte -->
<script>
// TODO: Create reactive variables
let colorInput = '';
let colorList = [];
// TODO: Implement addColor function
function addColor() {
// Add color to list
// Clear input
// Update UI
}
</script>
<!-- TODO: Create form UI -->
<!-- TODO: Iterate over colorList -->
{#if colorList.length > 0}
<!-- TODO: Show colors -->
{:else}
<!-- TODO: Show empty state -->
{/if}
<!-- TODO: Implement delete logic -->
function deleteColor(index) {
// Remove color from array
}
Your project is complete when:
{#if}
and {#each}
properlyTest these scenarios:
Criteria | Points | Description |
---|---|---|
Functionality | 40 | Color input, list display, delete works |
Svelte Logic | 30 | Proper use of {#if} , {#each} , reactivity |
Code Quality | 20 | Clean code, comments, organization |
UI/UX | 10 | User-friendly interface, visual design |
Total | 100 |
Issue: Colors not displaying after adding
Solution: Check if you're properly updating the reactive colorList
array
Issue: Delete not working Solution: Use array methods that trigger reactivity (filter, splice with assignment)
Issue: Invalid colors accepted Solution: Add validation for hex format before adding to list
When ready to deploy:
npm run build
../../Project/Project 03- Play With Colours.mdx
Remember: This is YOUR project. The template provides the structure, but you build the features. Research, experiment, and create something unique!