Skip to content

Add color palette rendering#4

Open
patricktrainer wants to merge 1 commit intomainfrom
national-egret
Open

Add color palette rendering#4
patricktrainer wants to merge 1 commit intomainfrom
national-egret

Conversation

@patricktrainer
Copy link
Copy Markdown
Owner

Changes Made

  1. CSS Color Classes (lines 45-54)

Added DOOM color palette:

  • Ceiling: dark blue-gray (#1a1a2e)
  • Floor: dark brown (#3d2817)
  • Walls: tan/brown gradient by distance (#c9a227 → #3a2d0a)
  • Enemies: red (#ff4444)
  • Bullets: yellow (#ffff00)
  • Player: green (#00ff00)
  1. SQL View Modified (line 225-226)

Added color_code column to render_3d_frame view - SQL now determines the color for each pixel based on:

  • C = ceiling
  • F = floor
  • 1-4 = wall at different distances (lighter = closer)
  1. JavaScript Updates
  • Added COLOR_MAP and escapeHtml() helpers (lines 80-91)
  • Updated render3d() to build dual buffers (char + color) and output HTML with colored elements (lines 266-375)
  • Updated renderMinimap() with the same coloring approach (lines 524-612)

Color Logic Location

All color decision logic is in SQL (the CASE statements in the view determine which color code each pixel gets). JavaScript only handles rendering the colors to HTML.

@patricktrainer patricktrainer self-assigned this Dec 8, 2025
@patricktrainer
Copy link
Copy Markdown
Owner Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant