summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.html8
-rw-r--r--public/fonts/fantasque.woffbin0 -> 49356 bytes
-rw-r--r--public/img/background.jpgbin0 -> 45441 bytes
-rw-r--r--public/img/cursor/hover.pngbin0 -> 1789 bytes
-rw-r--r--public/img/cursor/regular.pngbin0 -> 3255 bytes
-rw-r--r--public/vite.svg1
-rw-r--r--src/App.tsx14
-rw-r--r--src/main.tsx3
-rw-r--r--src/pages/ChooseArt.tsx45
-rw-r--r--src/pages/Paint.tsx11
-rw-r--r--src/styles/colors.css119
-rw-r--r--src/styles/styles.css140
12 files changed, 336 insertions, 5 deletions
diff --git a/index.html b/index.html
index b8fd1a2..da18db3 100644
--- a/index.html
+++ b/index.html
@@ -6,7 +6,13 @@
<title>ansicolor</title>
</head>
<body>
- <div id="root"></div>
+ <header>
+ <h1 class="bright2">## ansicolor</h1>
+ <hr />
+ </header>
+ <main>
+ <div id="root" style="display:flex; align-items: center; justify-content: center; height: 100%;"></div>
+ </main>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
diff --git a/public/fonts/fantasque.woff b/public/fonts/fantasque.woff
new file mode 100644
index 0000000..a239067
--- /dev/null
+++ b/public/fonts/fantasque.woff
Binary files differ
diff --git a/public/img/background.jpg b/public/img/background.jpg
new file mode 100644
index 0000000..e54d261
--- /dev/null
+++ b/public/img/background.jpg
Binary files differ
diff --git a/public/img/cursor/hover.png b/public/img/cursor/hover.png
new file mode 100644
index 0000000..2e2c248
--- /dev/null
+++ b/public/img/cursor/hover.png
Binary files differ
diff --git a/public/img/cursor/regular.png b/public/img/cursor/regular.png
new file mode 100644
index 0000000..f9fbfca
--- /dev/null
+++ b/public/img/cursor/regular.png
Binary files differ
diff --git a/public/vite.svg b/public/vite.svg
deleted file mode 100644
index e7b8dfb..0000000
--- a/public/vite.svg
+++ /dev/null
@@ -1 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg> \ No newline at end of file
diff --git a/src/App.tsx b/src/App.tsx
index 8666e34..3623384 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,5 +1,13 @@
+import { useState } from "react";
+import { ChooseArt } from "./pages/ChooseArt";
+import { Paint } from "./pages/Paint";
+
export const App: React.FC = () => {
- return <div>
- hello
- </div>
+ const [chosenArt, setChosenArt] = useState<undefined | string>(undefined);
+
+ if (chosenArt === undefined) {
+ return <ChooseArt artSubmissionCallback={setChosenArt} />
+ }
+
+ return <Paint art={chosenArt} />
}
diff --git a/src/main.tsx b/src/main.tsx
index 65bf1da..32ff2d4 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -1,6 +1,9 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
+import '@/styles/colors.css';
+import '@/styles/styles.css';
+
import { App } from '@/App';
createRoot(document.getElementById('root')!).render(
diff --git a/src/pages/ChooseArt.tsx b/src/pages/ChooseArt.tsx
new file mode 100644
index 0000000..fab6d79
--- /dev/null
+++ b/src/pages/ChooseArt.tsx
@@ -0,0 +1,45 @@
+import type React from 'react';
+import { useEffect, useRef, useState } from 'react';
+
+export interface ChooseArtProps {
+ artSubmissionCallback: (art: string) => void;
+}
+
+export const ChooseArt: React.FC<ChooseArtProps> = ({
+ artSubmissionCallback,
+}) => {
+ const [art, setArt] = useState('');
+ const promptRef = useRef<HTMLTextAreaElement>(null);
+
+ useEffect(() => {
+ if (!promptRef.current) {
+ return;
+ }
+ // Automatically focus the textarea when the component mounts
+ promptRef.current.focus();
+ }, [promptRef]);
+
+ const handleSubmit = () => {
+ if (!art.trim()) {
+ return;
+ }
+ artSubmissionCallback(art);
+ };
+
+ return (
+ <div>
+ <textarea
+ ref={promptRef}
+ value={art}
+ onChange={(e) => setArt(e.target.value)}
+ placeholder='paste your ascii art here...'
+ rows={15}
+ cols={80}
+ />
+ <div className={"maybe-visible " + (art.trim() ? "visible" : "invisible")}>
+ <hr />
+ <button onClick={handleSubmit}>color!</button>
+ </div>
+ </div>
+ );
+};
diff --git a/src/pages/Paint.tsx b/src/pages/Paint.tsx
new file mode 100644
index 0000000..5284b26
--- /dev/null
+++ b/src/pages/Paint.tsx
@@ -0,0 +1,11 @@
+import { useState } from 'react';
+
+export interface ChooseArtProps {
+ art: string;
+}
+
+export const Paint: React.FC<ChooseArtProps> = ({ art: initArt }) => {
+ const [art, setArt] = useState<string>(initArt);
+
+ return <div>{art}</div>;
+};
diff --git a/src/styles/colors.css b/src/styles/colors.css
new file mode 100644
index 0000000..6d568ea
--- /dev/null
+++ b/src/styles/colors.css
@@ -0,0 +1,119 @@
+:root {
+ --background: #282828;
+ --background-body: #282828da;
+ --foreground: #ebdbb2;
+ --regular0: #282828;
+ --regular1: #cc241d;
+ --regular2: #98971a;
+ --regular3: #d79921;
+ --regular4: #458588;
+ --regular5: #b16286;
+ --regular6: #689d6a;
+ --regular7: #a89984;
+ --bright0: #928374;
+ --bright1: #fb4934;
+ --bright2: #b8bb26;
+ --bright3: #fabd2f;
+ --bright4: #83a598;
+ --bright5: #d3869b;
+ --bright6: #8ec07c;
+ --bright7: #ebdbb2;
+}
+
+.regular0 {
+ color: var(--regular0);
+}
+.regular1 {
+ color: var(--regular1);
+}
+.regular2 {
+ color: var(--regular2);
+}
+.regular3 {
+ color: var(--regular3);
+}
+.regular4 {
+ color: var(--regular4);
+}
+.regular5 {
+ color: var(--regular5);
+}
+.regular6 {
+ color: var(--regular6);
+}
+.regular7 {
+ color: var(--regular7);
+}
+.bright0 {
+ color: var(--bright0);
+}
+.bright1 {
+ color: var(--bright1);
+}
+.bright2 {
+ color: var(--bright2);
+}
+.bright3 {
+ color: var(--bright3);
+}
+.bright4 {
+ color: var(--bright4);
+}
+.bright5 {
+ color: var(--bright5);
+}
+.bright6 {
+ color: var(--bright6);
+}
+.bright7 {
+ color: var(--bright7);
+}
+
+.regular0-bg {
+ background-color: var(--regular0);
+}
+.regular1-bg {
+ background-color: var(--regular1);
+}
+.regular2-bg {
+ background-color: var(--regular2);
+}
+.regular3-bg {
+ background-color: var(--regular3);
+}
+.regular4-bg {
+ background-color: var(--regular4);
+}
+.regular5-bg {
+ background-color: var(--regular5);
+}
+.regular6-bg {
+ background-color: var(--regular6);
+}
+.regular7-bg {
+ background-color: var(--regular7);
+}
+.bright0-bg {
+ background-color: var(--bright0);
+}
+.bright1-bg {
+ background-color: var(--bright1);
+}
+.bright2-bg {
+ background-color: var(--bright2);
+}
+.bright3-bg {
+ background-color: var(--bright3);
+}
+.bright4-bg {
+ background-color: var(--bright4);
+}
+.bright5-bg {
+ background-color: var(--bright5);
+}
+.bright6-bg {
+ background-color: var(--bright6);
+}
+.bright7-bg {
+ background-color: var(--bright7);
+}
diff --git a/src/styles/styles.css b/src/styles/styles.css
new file mode 100644
index 0000000..1bf4663
--- /dev/null
+++ b/src/styles/styles.css
@@ -0,0 +1,140 @@
+@font-face {
+ font-family: 'fantasque';
+ src: url('/fonts/fantasque.woff');
+}
+
+:root {
+ --content-padding: 2rem;
+ --border-radius: 10px;
+
+ --font: 'fantasque';
+ --font-fallback: monospace;
+}
+
+/* <global> */
+* {
+ cursor: url('/img/cursor/regular.png'), auto !important;
+ color: var(--foreground);
+ font-family: var(--font), var(--font-fallback);
+
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+}
+/* </global> */
+
+/* <layout> */
+html {
+ display: flex;
+ justify-content: center;
+ min-height: 100vh;
+ padding: var(--content-padding);
+
+ background-image: url('/img/background.jpg');
+ background-repeat: repeat;
+}
+
+body {
+ display: grid;
+ grid-template-rows: auto 1fr auto;
+
+ padding: var(--content-padding);
+ padding-left: auto;
+ border-radius: var(--border-radius);
+ min-height: calc(100vh - 2 * var(--content-padding));
+
+ width: 100%;
+ max-width: 1200px;
+ background-color: var(--background-body);
+ backdrop-filter: blur(16px);
+}
+
+main {
+ height: 100%;
+ overflow-y: scroll;
+}
+/* </layout> */
+
+/* <typography> */
+h1 {
+ font-size: 3rem;
+}
+h2 {
+ font-size: 2rem;
+}
+h3 {
+ font-size: 1.45rem;
+}
+hr {
+ margin: 1rem;
+ border: 0;
+ height: 1px;
+ background-image: linear-gradient(
+ to right,
+ rgba(0, 0, 0, 0.1),
+ var(--foreground),
+ rgba(0, 0, 0, 0.1)
+ );
+}
+a {
+ color: var(--regular6);
+}
+/* </typography> */
+
+/* <footer> */
+.blinkies {
+ display: flex;
+ justify-content: left;
+ flex-wrap: wrap;
+ gap: 10px 10px;
+}
+/* </footer> */
+
+/* <form> */
+textarea {
+ height: 30rem;
+ border: 3px solid var(--regular3);
+ padding: 1rem;
+ border-radius: 4px;
+ background: none;
+ resize: vertical;
+}
+textarea:hover {
+ cursor: url('/img/cursor/hover.png'), auto !important;
+}
+*:focus {
+ border-color: var(--regular6);
+ outline: none;
+ transition: border-color 0.5s;
+}
+/* </form> */
+
+/* <visibility> */
+.maybe-visible {
+ transition: opacity 0.5s;
+}
+
+.visible {
+ opacity: 1;
+}
+
+.invisible {
+ opacity: 0;
+}
+/* </visibility> */
+
+/* <buttons> */
+button {
+ background: none;
+ display: block;
+ border: 3px solid var(--regular3);
+ border-radius: 4px;
+ width: 100%;
+ padding: 8px;
+}
+button:hover {
+ cursor: url('/img/cursor/hover.png'), auto !important;
+ border: 3px solid var(--regular6);
+ transition: border-color 0.2s;
+}
+/* </buttons> */