{"spec_id":"chessboard-basic","library":"makie","language":"julia","code":"# anyplot.ai\n# chessboard-basic: Chess Board Grid Visualization\n# Library: makie 0.21.9 | Julia 1.11.9\n# Quality: 91/100 | Created: 2026-09-01\n\nusing CairoMakie\nusing Colors\n\n# --- Theme tokens -----------------------------------------------------------\nconst THEME    = get(ENV, \"ANYPLOT_THEME\", \"light\")\nconst PAGE_BG  = THEME == \"light\" ? colorant\"#FAF8F1\" : colorant\"#1A1A17\"\nconst INK      = THEME == \"light\" ? colorant\"#1A1A17\" : colorant\"#F0EFE8\"\nconst INK_SOFT = THEME == \"light\" ? colorant\"#4A4A44\" : colorant\"#B8B7B0\"\n\n# Board squares pair the Imprint brand green (dark square) with the fixed\n# Imprint amber anchor (light square) — both data colors stay identical\n# across themes; only the surrounding chrome (background/text/grid) flips.\nconst DARK_SQUARE  = colorant\"#009E73\"\nconst LIGHT_SQUARE = colorant\"#DDCC77\"\n\n# --- Data ---------------------------------------------------------------\n# Standard chess board: a1 is dark, light squares at h1 and a8.\n# (file index + rank index) even -> dark square; odd -> light square.\nfiles = 'a':'h'\nranks = 1:8\nsquares      = [Rect2f(f + 0.5, r + 0.5, 1, 1) for f in 0:7 for r in 0:7]\nsquare_color = [(f + r) % 2 == 0 ? DARK_SQUARE : LIGHT_SQUARE for f in 0:7 for r in 0:7]\n\n# --- Plot -------------------------------------------------------------------\ntitle_str = \"chessboard-basic · julia · makie · anyplot.ai\"\n\nfig = Figure(\n    resolution      = (1200, 1200),\n    fontsize        = 14,\n    backgroundcolor = PAGE_BG,\n)\n\nax = Axis(\n    fig[1, 1];\n    title             = title_str,\n    titlesize         = 20,\n    titlecolor        = INK,\n    aspect            = DataAspect(),\n    backgroundcolor   = PAGE_BG,\n    xticks            = (1:8, string.(collect(files))),\n    yticks            = (1:8, string.(collect(ranks))),\n    xticklabelcolor   = INK_SOFT,\n    yticklabelcolor   = INK_SOFT,\n    xticklabelsize    = 16,\n    yticklabelsize    = 16,\n    xticksvisible     = false,\n    yticksvisible     = false,\n    topspinevisible   = false,\n    rightspinevisible = false,\n    leftspinecolor    = INK_SOFT,\n    bottomspinecolor  = INK_SOFT,\n    xgridvisible      = false,\n    ygridvisible      = false,\n)\n\n# Each square is its own poly! Rect2f — a Makie-idiomatic geometry\n# primitive rather than a generic two-color heatmap — with a thin ink\n# hairline stroke between squares for definition.\nhairline = RGBAf(INK.r, INK.g, INK.b, 0.15)\npoly!(ax, squares; color = square_color, strokecolor = hairline, strokewidth = 1)\n\n# Outer board frame: a crisp ink-soft border around the full 8x8 grid gives\n# the eye a clean boundary and extra polish beyond the flat square fills.\nlines!(ax, [0.5, 8.5, 8.5, 0.5, 0.5], [0.5, 0.5, 8.5, 8.5, 0.5]; color = INK_SOFT, linewidth = 2.5)\n\nlimits!(ax, 0.5, 8.5, 0.5, 8.5)\n\n# --- Save -------------------------------------------------------------------\nsave(\"plot-$(THEME).png\", fig; px_per_unit = 2)\n"}