You can't design a filter that creates a phase shift that's constant with frequency for real valued input (if that's what you are trying to do).
A Hilbert transformer appears to be doing this. However, the problem is, you can't implement a perfect Hilbert transformer since it's non causal with an infinite length impulse response.
The tricky part is that the DC and Nyquist components of the spectrum have to be real valued and that the phase at these frequencies is constrained to $0$ or $\pi$. Any phase shifter would have to have a transition band from DC to the to target phase and from the target phase to Nyquist.
That's exactly what happens if you design a real-world Hilbert transformer: you trade off the size of the transition bands against the length & complexity of the filter.
The class of filters that only manipulate phase and not the amplitude are called allpass filters. One can easily show that
- Allpass filters have a phase that's monotonously decreasing
- For an allpass filter of oder $N$ the phase from DC to Nyquist decreases by $N \cdot \pi$
- Allpass have zeros that are inverses of the poles,
- The z-transform numerator polynomial is the reverse of denominator polynomial
Of course you can always design an "approximation" that's good enough for your requirement. You'd have to specify the target bandwidth, max phase error, max amplitude error and then deploy a suitable FIR or IIR design method
Even an approximate design of absolute phase shift is quite difficult, especially if you have latency or causality constraints. Constant relative phase shift is a lot easier. A popular technique is to run a signal through two parallel allpass filters which are designed to have a constant phase difference over the frequency area of interest. The outputs have identical amplitude as the input but have approximately constant phase shift with respect to each other (although not with respect to the input)