@@ -50,3 +50,70 @@ table {
5050.card , .card img {
5151 background-color : var (--pst-color-background );
5252}
53+
54+ /* Buttons for JupyterLite-enabled interactive examples */
55+ /* adapted from https://github.com/numpy/numpy/pull/26745 */
56+
57+ .try_examples_button {
58+ position : relative;
59+ overflow : hidden;
60+ color : white;
61+ background-color : var (--pst-color-info );
62+ border : none;
63+ padding : 5px 10px ;
64+ border-radius : 0.25rem ;
65+ margin-top : 3px ; /* better alignment under admonitions */
66+ margin-bottom : 5px !important ; /* fix uneven button sizes under admonitions */
67+ box-shadow : 0 2px 5px rgba (108 , 108 , 108 , 0.2 );
68+ font-weight : bold;
69+ font-size : small;
70+ }
71+
72+ /* Use more acccessible colours for text in dark mode */
73+ [data-theme = dark ] .try_examples_button {
74+ color : black;
75+ }
76+
77+ .try_examples_button : after {
78+ content : '' ;
79+ position : absolute;
80+ top : -50% ;
81+ right : -50% ;
82+ bottom : -50% ;
83+ left : -50% ;
84+ background : linear-gradient (to bottom, rgba (229 , 172 , 142 , 0 ), rgba (255 , 255 , 255 , 0.5 ) 50% , rgba (229 , 172 , 142 , 0 ));
85+ transform : rotateZ (-60deg ) translate (-12em , -5em ); /* Starting from the left */
86+ }
87+
88+ /* Activate sheen effect on hover */
89+ .try_examples_button : hover ::after {
90+ animation : jupyterSheen 1s forwards;
91+ }
92+
93+ @keyframes jupyterSheen {
94+ 100% {
95+ transform : rotateZ (-60deg ) translate (12em , 10em );
96+ }
97+ }
98+
99+ .try_examples_button : hover {
100+ transform : scale (1.02 );
101+ box-shadow : 0 2px 5px rgba (0 , 0 , 0 , 0.2 );
102+ cursor : pointer;
103+ }
104+
105+ .try_examples_button : focus {
106+ outline : 0 ;
107+ }
108+
109+ .try_examples_button_container {
110+ display : flex;
111+ justify-content : flex-start;
112+ gap : 10px ;
113+ margin-bottom : 20px ;
114+ }
115+
116+ /* Better gaps for examples buttons under admonitions */
117+ .try_examples_outer_iframe {
118+ margin-top : 0.4em ;
119+ }
0 commit comments