Skip to content

Commit 38a3a20

Browse files
committed
Merge colorstudy2_feb into main
2 parents 5e2cd0a + 915edb3 commit 38a3a20

131 files changed

Lines changed: 30745 additions & 6561 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
VITE_BASE_PATH="/study/"
22
VITE_FIREBASE_CONFIG='
33
{
4-
apiKey: "AIzaSyAm9QtUgx1lYPDeE0vKLN-lK17WfUGVkLo",
5-
authDomain: "revisit-utah.firebaseapp.com",
6-
projectId: "revisit-utah",
7-
storageBucket: "revisit-utah.appspot.com",
8-
messagingSenderId: "811568460432",
9-
appId: "1:811568460432:web:995f6b4f1fc8042b5dde15"
4+
apiKey: "AIzaSyDq1njfXz0s7SQICEQCL_VjbSngqD53-0A",
5+
authDomain: "view-revisit.firebaseapp.com",
6+
projectId: "view-revisit",
7+
storageBucket: "view-revisit.firebasestorage.app",
8+
messagingSenderId: "595567496565",
9+
appId: "1:595567496565:web:f4a7ee02bd8a3efb1e573c"
1010
}
1111
'
12-
VITE_STORAGE_ENGINE="localStorage" # "firebase" or "supabase" or "localStorage" or your own custom storage engine
13-
VITE_RECAPTCHAV3TOKEN="6LdjOd0lAAAAAASvFfDZFWgtbzFSS9Y3so8rHJth" # recaptcha SITE KEY
12+
VITE_RECAPTCHAV3TOKEN="6LfaDFcsAAAAAIeDQp0kGgG8TcGaV6k1yWhes7U9"
13+
VITE_STORAGE_ENGINE="firebase" # "firebase" or "supabase" or "localStorage" or your own custom storage engine
1414
VITE_REPO_URL="https://github.com/revisit-studies/study/tree/main/public/" # Set the url for the "view source" link on the front page
1515

1616
VITE_SUPABASE_URL="https://supabase.revisit.dev"

.github/workflows/vitest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Playwright Tests
1+
name: Unit Tests
22

33
on:
44
pull_request:

claude.md renamed to AGENTS.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Tech Stack
44
- TypeScript
55
- Vite
66
- Mantine UI
7-
- Firebase/Supabase both with storage and database
7+
- Firebase or Supabase as storage and database backends (.env selects the engine)
88
- Redux for state management with our in-house library Trrack.js for provenance tracking
9-
- Specific Lodash functions (debounce, throttle, isEqual, merge)
9+
- Lodash usage is restricted to: debounce, throttle, isEqual, merge
1010
- React Router for routing
1111
- Eslint and airbnb style guide for code quality
1212

@@ -22,10 +22,10 @@ Verbiage
2222
- "Study Config": The configuration file that defines the parameters and settings of a user study.
2323

2424
Study Configs
25-
The study configurations are defined in JSON files with schemas. These configs specify various aspects of the study, including the visualization tools to be used, the tasks participants need to complete, and the data sources involved. You can find the full definition of the study config schema in the typescript file at src/parser/types.ts. The answers and participant data specifications are stored separately from the study config to allow for flexibility in data collection and analysis, at src/store/types.ts.
25+
The study configurations are defined in JSON files with schemas. These configs specify various aspects of the study, including the visualization tools to be used, the tasks participants need to complete, and the data sources involved. You can find the full definition of the study config schema in the typescript file at src/parser/types.ts. The answers and participant data specifications are stored separately from the study config to allow for flexibility in data collection and analysis, at src/store/types.ts. Study config JSON files live in the public folder under the /public/{studyName}/config.json path.
2626

2727
Imported Libraries
28-
We provide several libraries to facilitate the development of user studies, such as vlat, mini-vlat, nasa-tlx, color-blindness, and more. These libraries are components and sequences that are defined in public/libraries/. Each library has its own folder containing the necessary code and assets. You can import these libraries into your study configs to enhance the functionality and user experience of your studies by adding the libraries to the top level `importedLibraries` field in the study config, and then referencing the components in the `baseComponent` field or in sequences and the sequences in the `sequences` field. When referencing the components and sequences use the following syntax `"$libraryName.components.componentName"` and `"$libraryName.sequences.sequenceName"` respectively.
28+
We provide several libraries to facilitate the development of user studies, such as vlat, mini-vlat, nasa-tlx, color-blindness, and more. These libraries are components and sequences that are defined in public/libraries/. Each library has its own folder containing the necessary code and assets. Use only libraries that exist under public/libraries/ (no ad-hoc local component imports in study configs). You can import these libraries into your study configs to enhance the functionality and user experience of your studies by adding the libraries to the top level `importedLibraries` field in the study config, and then referencing the components in the `baseComponent` field or in sequences and the sequences in the `sequences` field. When referencing the components and sequences use the following syntax `"$libraryName.components.componentName"` and `"$libraryName.sequences.sequenceName"` respectively.
2929

3030
Storage Engines
3131
ReVISit supports multiple storage backends for storing study data, including Firebase and Supabase. This allows researchers to choose the backend that best fits their needs in terms of scalability, ease of use, and integration with other tools. The storage engines are abstracted in the codebase, allowing for easy addition of new storage solutions in the future. The storage engine implementations can be found in src/storage/ directory.
@@ -34,4 +34,7 @@ How you should interact with the codebase
3434
When working with the ReVISit codebase, work only with the source code files available to you. If you need an external library, please ask for approval first (and include how well used the library is). Make sure to follow best practices for React and TypeScript development, including proper state management, component structuring, and code documentation. Pay extra attention to lifecycle methods and hooks to ensure optimal performance and avoid memory leaks, including any updates to existing code. If you encounter any issues or have suggestions for improvements, feel free to bring them up for discussion. Don't interact with git and GitHub directly; instead, focus on the code itself. I'll handle version control and repository management. Always check package.json for the scripts available to you for building, testing, and running the project.
3535

3636
Testing
37-
When adding a new feature or modifying code try to maximize unit test coverage. Unit tests should be colocated with the files they are testing, have the same names as the file with .spec., and use the vitest framework. Apply this to both UI/react code as well as non-UI code. For UI code, we use playwright for end-to-end testing. Try to add e2e tests for any new features that involve user interaction. E2E tests are located in the tests/ directory at the root of the project. Don't run `yarn test` directly; instead, describe the tests you want to run, and I'll handle executing them. You can run unittests locally using `yarn unittest`.
37+
When adding a new feature or modifying code try to maximize unit test coverage. Unit tests should be colocated with the files they are testing, have the same names as the file with .spec., and use the vitest framework. Apply this to both UI/react code as well as non-UI code. For UI code, we use playwright for end-to-end testing. Try to add e2e tests for any new features that involve user interaction. E2E tests are located in the tests/ directory at the root of the project. Don't run `yarn test` directly; instead, describe the tests you want to run, and I'll handle executing them. You can run unittests locally using `yarn unittest`. Preferred commands are those listed in package.json (e.g., `yarn unittest`, `yarn lint`, `yarn serve`, `yarn build`).
38+
39+
Parser
40+
When adding new features, sometimes it's required to update the parser and the associated types. The parser is located in src/parser/. The parser is responsible for validating and transforming the study config JSON files into a format that the application can use. When updating the parser, ensure that you also update the corresponding types in src/parser/types.ts to reflect any changes made to the study config schema. Make sure to add unit tests for any new parser functionality to ensure its correctness. Additionally, changes to the parser types will require updates to the generated JSON schema files located in src/schemas/. You can regenerate these schema files by running `yarn generate-schemas`.

libraryDocGenerator.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ${libraryConfig.additionalDescription ? `## Additional Description\n\n${libraryC
3535
3636
${forDocs
3737
? `<!-- Importing Links -->
38-
import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLinks.tsx';
38+
import StructuredLinks from '@site/src/components/StructuredLinks/StructuredLinks.tsx';
3939
4040
<StructuredLinks
4141
demoLinks={[

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,35 @@
2424
"@dnd-kit/core": "^6.3.1",
2525
"@dnd-kit/sortable": "^10.0.0",
2626
"@dnd-kit/utilities": "^3.2.2",
27+
"@emotion/react": "^11.0.0",
28+
"@emotion/styled": "^11.0.0",
2729
"@mantine/core": "^7.10.1",
2830
"@mantine/dates": "^7.10.1",
2931
"@mantine/form": "^7.10.1",
3032
"@mantine/hooks": "^7.10.1",
3133
"@mantine/modals": "^7.10.1",
3234
"@mantine/notifications": "^7.12.0",
35+
"@mui/icons-material": "^7.0.0",
36+
"@mui/material": "^7.0.0",
37+
"@mui/system": "^7.0.0",
38+
"@mui/x-data-grid": "^8.0.0",
3339
"@quentinroy/latin-square": "^1.1.1",
3440
"@reduxjs/toolkit": "^2.9.0",
3541
"@supabase/supabase-js": "^2.57.4",
3642
"@tabler/icons-react": "^3.35.0",
43+
"@tanstack/react-virtual": "^3.13.13",
3744
"@trrack/core": "^1.3.0",
45+
"@trrack/vis-react": "^1.3.0",
3846
"@types/crypto-js": "^4.2.2",
3947
"@types/hjson": "^2.4.6",
4048
"@types/node": "^24.5.2",
41-
"@visdesignlab/upset2-react": "^1.0.0",
49+
"@visdesignlab/upset2-react": "^1.0.2",
4250
"ajv": "^8.17.1",
4351
"arquero": "^5.4.0",
4452
"crypto-js": "^4.2.0",
4553
"d3": "^7.9.0",
4654
"dayjs": "^1.11.18",
55+
"diff": "^8.0.2",
4756
"eslint-config-airbnb": "^19.0.4",
4857
"firebase": "^11.2.0",
4958
"hjson": "^3.2.2",
@@ -61,6 +70,7 @@
6170
"react-redux": "^9.2.0",
6271
"react-router": "^7.12.0",
6372
"react-vega": "^7.6.0",
73+
"recoil": "^0.5.0",
6474
"rehype-raw": "^7.0.0",
6575
"remark-gfm": "^4.0.1",
6676
"ts-json-schema-generator": "^2.4.0",
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Color Grid Layout Documentation
2+
3+
## Systematic 3×3 Color Selection Grid
4+
5+
### Visual Layout
6+
7+
```
8+
┌──────────────────────┬──────────────────────┬──────────────────────┐
9+
│ Darker, -a* │ Darker, -b* │ Darker, +a* │
10+
│ L: -20 │ L: -20 │ L: -20 │
11+
│ a: -2.3 │ a: 0 │ a: +2.3 │
12+
│ b: 0 │ b: -2.3 │ b: 0 │
13+
│ (less red) │ (less yellow) │ (more red) │
14+
├──────────────────────┼──────────────────────┼──────────────────────┤
15+
│ Same L, -a* │ ★ ORIGINAL ★ │ Same L, +a* │
16+
│ L: 0 │ L: 0 │ L: 0 │
17+
│ a: -2.3 │ a: 0 │ a: +2.3 │
18+
│ b: 0 │ b: 0 │ b: 0 │
19+
│ (less red) │ (unchanged) │ (more red) │
20+
├──────────────────────┼──────────────────────┼──────────────────────┤
21+
│ Lighter, -a* │ Lighter, +b* │ Lighter, +a* │
22+
│ L: +20 │ L: +20 │ L: +20 │
23+
│ a: -2.3 │ a: 0 │ a: +2.3 │
24+
│ b: 0 │ b: +2.3 │ b: 0 │
25+
│ (less red) │ (more yellow) │ (more red) │
26+
└──────────────────────┴──────────────────────┴──────────────────────┘
27+
```
28+
29+
### Color Space Dimensions
30+
31+
#### CIELAB Color Space
32+
The CIELAB (or L\*a\*b\*) color space is designed to be perceptually uniform:
33+
- **L\* (Lightness):** 0 (black) to 100 (white)
34+
- **a\*:** Green (-) to Red (+)
35+
- **b\*:** Blue (-) to Yellow (+)
36+
37+
#### Parameters
38+
39+
| Parameter | Value | Description |
40+
|-----------|-------|-------------|
41+
| **JND** | 2.3 | Just Noticeable Difference in Delta E (perceptual threshold) |
42+
| **L\* Step** | 10 | Lightness change per step |
43+
| **L\* Range** | ±20 | Total lightness variation (2 steps) |
44+
| **a\* Shift** | ±2.3 | Red-green dimension shift (1 JND) |
45+
| **b\* Shift** | ±2.3 | Yellow-blue dimension shift (1 JND) |
46+
47+
### Design Rationale
48+
49+
1. **Center Position (Position 4):** Always shows the original color for easy reference
50+
2. **Horizontal Axis (Positions 3, 4, 5):** Explores red/green dimension at constant lightness
51+
3. **Vertical Axis (Positions 1, 4, 7):** Explores yellow/blue dimension with lightness changes
52+
4. **Diagonal Corners:** Combine lightness changes with red/green shifts
53+
5. **Perceptual Uniformity:** All shifts are based on JND, ensuring consistent perceptual differences
54+
55+
### Example Transformation
56+
57+
Starting with a blue color: `#3A7DFF`
58+
59+
**LAB values:** L=52, a=13, b=-60
60+
61+
**Generated alternatives:**
62+
- Position 0: L=32, a=10.7, b=-60 (darker, less red)
63+
- Position 1: L=32, a=13, b=-62.3 (darker, less yellow/more blue)
64+
- Position 2: L=32, a=15.3, b=-60 (darker, more red)
65+
- Position 3: L=52, a=10.7, b=-60 (same L, less red)
66+
- **Position 4: L=52, a=13, b=-60 (ORIGINAL)**
67+
- Position 5: L=52, a=15.3, b=-60 (same L, more red)
68+
- Position 6: L=72, a=10.7, b=-60 (lighter, less red)
69+
- Position 7: L=72, a=13, b=-57.7 (lighter, more yellow/less blue)
70+
- Position 8: L=72, a=15.3, b=-60 (lighter, more red)
71+
72+
### Adjusting JND
73+
74+
To modify the perceptual difference between alternatives, change the `JND_LAB` constant:
75+
76+
```typescript
77+
// More subtle differences (harder to distinguish)
78+
const JND_LAB = 1.5;
79+
80+
// More obvious differences (easier to distinguish)
81+
const JND_LAB = 4.0;
82+
83+
// Current setting (standard perceptual threshold)
84+
const JND_LAB = 2.3;
85+
```
86+
87+
### Gamut Considerations
88+
89+
**Problem:** Not all LAB colors can be displayed in sRGB (the color space of most displays).
90+
91+
**Solution:** The `clampChroma` function automatically finds the nearest displayable color:
92+
- Maintains the same L\* and hue
93+
- Reduces chroma (saturation) until color is displayable
94+
- Preserves perceptual relationships as much as possible
95+
96+
**When it matters:**
97+
- Very saturated colors at extreme lightness values
98+
- Colors near the edges of sRGB gamut
99+
- Vivid reds, blues, and greens are most affected
100+
101+
### Research Applications
102+
103+
This systematic grid enables:
104+
1. **Perceptual studies:** Compare JND values across different base colors
105+
2. **Preference mapping:** Identify which color space dimensions drive preferences
106+
3. **Visualization quality:** Test how color changes affect chart readability
107+
4. **Color palette design:** Systematically explore alternatives to palette colors
108+
109+
### Implementation Details
110+
111+
The color transformation pipeline:
112+
1. Parse hex color → LAB color space
113+
2. Apply dimensional shifts (L, a, b)
114+
3. Clamp L to valid range [0, 100]
115+
4. Clamp chroma to sRGB gamut
116+
5. Convert back to hex color
117+
6. Handle errors gracefully (return original if conversion fails)
118+
119+
### References
120+
121+
- **Delta E:** CIE 2000 color difference formula (ΔE\*₀₀)
122+
- **JND Standard:** Approximately 2.3 ΔE units (varies by context)
123+
- **CIELAB:** Commission Internationale de l'Éclairage (1976)
124+
- **Color Library:** Culori v4.0.2 (https://culorijs.org/)

0 commit comments

Comments
 (0)