Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generic lookup field colored pills #820

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
2635039
Create Eisenhower Matrix
jaxkookie Mar 14, 2024
8e5385b
Create Readme.md
jaxkookie Mar 14, 2024
926c81b
Add files via upload
jaxkookie Mar 14, 2024
72d55f7
Create View requirements
jaxkookie Mar 14, 2024
82967e8
Create eisenhower-matrix.json
jaxkookie Mar 14, 2024
cfbce1f
Create View requirements.html
jaxkookie Mar 14, 2024
df447f5
Create sample.json
jaxkookie Mar 14, 2024
c81d731
Add files via upload
jaxkookie Mar 14, 2024
186c6a6
Update Readme.md
jaxkookie Mar 14, 2024
02037b9
Update Readme.md
jaxkookie Mar 14, 2024
fba990e
Delete column-samples/task-matrix/EisenhowerMatrix.png
jaxkookie Mar 14, 2024
9d18ba0
Update View requirements
jaxkookie Mar 14, 2024
09f950b
Delete column-samples/task-matrix/View requirements
jaxkookie Mar 14, 2024
7943569
Delete column-samples/task-matrix/View requirements.html
jaxkookie Mar 14, 2024
1ee3c38
Update Readme.md
jaxkookie Mar 14, 2024
119105c
Update Readme.md
jaxkookie Mar 14, 2024
7ea721e
Update Readme.md
jaxkookie Mar 14, 2024
a5e19d2
Update eisenhower-matrix.json
jaxkookie Mar 14, 2024
2a684be
Create readme.md
jaxkookie Mar 14, 2024
bf661f0
Update readme.md
jaxkookie Mar 14, 2024
a14686c
Create sample.json
jaxkookie Mar 14, 2024
67bbd47
Update sample.json
jaxkookie Mar 14, 2024
d7f40b4
Add files via upload
jaxkookie Mar 14, 2024
401b0ba
Create generic-context-menu.json
jaxkookie Mar 14, 2024
021593a
Delete file
tecchan1107 Mar 28, 2024
14a2f39
Convert HTML to Markdown - generic-context-menu
tecchan1107 Mar 28, 2024
941cef8
Rename filename
tecchan1107 Mar 28, 2024
889fd59
Update sample.json - generic-context-menu
tecchan1107 Mar 28, 2024
5d1382d
Delete creadme.md
tecchan1107 Mar 28, 2024
c193388
Rename folder - generic-eisenhower-matrix
tecchan1107 Mar 28, 2024
8ebeb7c
Rename filenames
tecchan1107 Mar 28, 2024
398b476
Convert HTML to Markdown - generic-eisenhower-matrix
tecchan1107 Mar 28, 2024
38510c0
Update sample.json - generic-eisenhower-matrix
tecchan1107 Mar 28, 2024
774e9d8
Fixed generic-context-menu.json
tecchan1107 Mar 31, 2024
691a01c
Update README.md with instructions for sample usage - generic-context…
tecchan1107 Apr 1, 2024
32ed5d6
Minor updates - generic-eisenhower-matrix
tecchan1107 Apr 2, 2024
1c38be6
Added note on Calculated Field - generic-eisenhower-matrix
tecchan1107 Apr 2, 2024
b0c131f
Minor update - generic-eisenhower-matrix
tecchan1107 Apr 2, 2024
cae90fb
Updated Date
tecchan1107 Apr 2, 2024
fa8d7e5
Added a class - generic-context-menu
tecchan1107 Apr 2, 2024
ee522fd
Updated sample.json - generic-context-menu
tecchan1107 Apr 2, 2024
d998e45
Merge branch 'pnp:master' into master
jaxkookie Jul 25, 2024
ba6d2dc
Create readme.md
jaxkookie Jul 25, 2024
b22a4f3
Create generic-dynamic-colored-pills.json
jaxkookie Jul 25, 2024
4e9f572
Add files via upload
jaxkookie Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"display": "flex",
"flex-wrap": "wrap",
"width": "100%"
},
"children": [
{
"elmType": "div",
"style": {
"margin": "2px auto"
},
"children": [
{
"elmType": "div",
"style": {
"vertical-align": "middle",
"white-space": "nowrap",
"width": "auto",
"padding": "5px",
"color": "=if( ((((ceiling((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5)) % 255) / 10) * 10) * 0.299) + (ceiling(((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5) + @currentField.lookupId ) % 255) / 10) * 10) * 0.587) + ((255 - ceiling(((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5) + @currentField.lookupId ) % 255) / 10) * 10)) * 0.114)) ) > 145, '#000000', '#ffffff')",
"background-color": "='rgba(' + (ceiling((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5)) % 255) / 10) * 10) + ', ' + (ceiling((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5) + @currentField.lookupId ) % 255) / 10) * 10) + ', ' + (255 - ceiling(((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5) + @currentField.lookupId ) % 255) / 10) * 10)) + ', 1)'",
"border-width": "2px",
"border-style": "solid",
"border-color": "='rgba(' + (255 - ceiling((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5)) % 255) / 10) * 10) + ', ' + (255 - ceiling((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5) + @currentField.lookupId ) % 255) / 10) * 10) + ', ' + (ceiling(((((@currentField.lookupValue.length) * pow(@currentField.lookupId, 5) + @currentField.lookupId ) % 255) / 10) * 10)) + ', 1)'",
"border-radius": "25px"
},
"children": [
{
"elmType": "span",
"style": {
"padding": "8px"
},
"txtContent": "@currentField.lookupValue"
}
]
}
]
}
]
}
3 changes: 3 additions & 0 deletions column-samples/generic-dynamic-colored-pills/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The JSON code to dynamically add colored pills to lookup columns. If you have a lookup column with more than 10 options or a lookup column that can have additional items added, managing the pill colors can be time-consuming. The code will calculate a color, background, and border color based on the length of the lookup value and the lookupId.

This code can be applied to any lookup column