@@ -404,12 +404,20 @@ export const colorRule: UtilityRule = (parsed, config) => {
404404 }
405405 }
406406
407- // Fallback to raw value for custom colors
408- const result = opacity !== undefined
409- ? applyOpacity ( colorValue , opacity )
410- : colorValue
411- colorCache . set ( value , result )
412- return { [ prop ] : result }
407+ // Only use fallback for arbitrary values (e.g., border-[#ff0000], text-[#ff0000]/50)
408+ // Don't return invalid values like 'b' as colors
409+ // Check parsed.arbitrary OR if colorValue looks like an arbitrary value (starts with '[')
410+ const isArbitrary = parsed . arbitrary || ( colorValue && colorValue . charCodeAt ( 0 ) === 91 ) // '[' char
411+ if ( isArbitrary && colorValue ) {
412+ const result = opacity !== undefined
413+ ? applyOpacity ( colorValue , opacity )
414+ : colorValue
415+ colorCache . set ( value , result )
416+ return { [ prop ] : result }
417+ }
418+
419+ // No valid color found - let other rules handle this
420+ return undefined
413421}
414422
415423// Helper to apply opacity to color (moved outside to reduce function creation)
@@ -541,6 +549,20 @@ export const borderWidthRule: UtilityRule = (parsed) => {
541549 if ( ! parsed . value ) {
542550 return { 'border-width' : '1px' }
543551 }
552+
553+ // Border width values: 0, 2, 4, 8
554+ const widthMap : Record < string , string > = {
555+ 0 : '0px' ,
556+ 2 : '2px' ,
557+ 4 : '4px' ,
558+ 8 : '8px' ,
559+ }
560+
561+ // Handle border-0, border-2, border-4, border-8
562+ if ( widthMap [ parsed . value ] ) {
563+ return { 'border-width' : widthMap [ parsed . value ] }
564+ }
565+
544566 const sideMap : Record < string , string | string [ ] > = {
545567 t : 'border-top-width' ,
546568 r : 'border-right-width' ,
0 commit comments